/
\ \
■: . -^ ^^: ■ *^%^^'*ii^^^
P^T*^ 1^
1
— ^-i^:3B
E ^ ,aBB
^B^^^H^HI^^^^^ -x MMM
i^^M
aqe bonus sectj
A Bit Pad for Your Micrcf
AIM Memory Maps _
6809 Super Features
r OSI a
t
;<^^
mA^
s Rev
lieil'L
j ujuimumuuni.
;iUlllJjyr|^4yMUt,^i„^.
i). mI. MtViMifif^;^ h)v'
*--3':, ■ ■ ■ I
i « • ii « i' "^0i^\' » • > K k fe » iiNb llllllli
•#J^i
li II
^m
r'Aji^. ■>«*• - .?»;
^-'^?1. '/
"! "-f^,
V
Turn your Apple into the world's
most versatile personal computer.
The SoftCard™ Solution. SoftCard
turns your Apple into two computers.
A Z-80 and a 6502. By adding a Z-80
microprocessor and CP/M to your
Apple, SoftCard turns your Apple into
a CP/M based machine. That means
you can access the single largest body
of microcomputer software in exist-
ence. Two computers in one. And, the
advantages of both.
Plug and go. The SoftCard system
starts with a Z-80 based circuit card.
Just plug it into any slot (except 0) of
your Apple. No modifications required.
SoftCard supports most of your Apple
peripherals, and, in 6502 -mode, your
Apple is .still your Apple.
CP/M for your Apple. You get CP/M
on disk with the SoftCard package. It's
a powerful and simple-to-use operating
system. It supports more software
than any other microcomputer operat-
ing system. And that's the key to the
versatility of the SoftCard/Apple,
CIRCLE READER SERVICE NUMBER
BASIC included. A powerful tool,
BASIC-80 IS included in the SoftCard
package. Running under CP/M, ANSI
Standard BASIC-80 is the most
powerful microcomputer BASIC
available. It includes extensive disk I/O
statements, error trapping, integer
variables, 16-digit precision, exten-
sive EDIT commands and string func-
tions, high and low-res Apple graphics,
PRINT USING, CHAIN and COM-
MON, plus many additional com-
mands. And, it's a BASIC you can
compile with Microsoft's BASIC
Compiler,
More languages. With SoftCard and
CP/M, you can add Microsoft's ANSI
Standard COBOL, and FORTRAN, or
Basic Compiler and Assembly Lan-
guage Development System. All, more
powerful tools for your Apple.
Seeing is believing. See the SoftCard
in operation at your Microsoft or Apple
dealer. We think you'll agree that the
SoftCard turns your Apple into the
world's most versatile personal
computer.
Complete information? It's at your
dealer's now. Or, we'll send it to you
and include a dealer list. Write us. Call
us. Or, circle the reader service card
number below.
SoftCard is a trademart, of Microsoft. Apple II and
Apple II Plus are registered trademarks of Apple
Computer Z-80 is a registered trademark of Zilog,
Inc. CP/M is a registered trademark of Digital
Research, Inc.
Microsoft Consumer Products, 400 108th Ave, N,E,,
Bellevue, WA 98004, (206) 454-1315
11
DATA CAPTURE 4.0
The most advanced and easiest to use telecommunications program for use
with the MICROMODEM l|3^^ or the Apple COMMUNICATIONS CARD®
Q. Wilt DATA CAPTURE 4.0 work with my Communica-
tions Card^ and a modem?
A. it makes using the Comm. Card almost as easy as using
the Micromodem il.
Q. Do I need an extra editor to prepare text for transmis-
sion to another computer?
A. No. DATA CAPTURE 4.0 gives you control of the text
buffer. You can use DATA CAPTURE 4.0 to create text.
Q. Can I edit the text I ham prepared?
A. Yes. You can Insert lines or delete any lines from the text.
Q. How atxMit text I have captured. Can I edit that?
A. As easily as ttie text you have prepared yourself. You can
delete any lines you don't want to print or save to a disk file.
You can also insert lines into the text.
Q. Just how much text can i capture with DATA
CAPTURE 4.0?
A. if the system with which you are communicating accepts a
stop character, most use a Control S, you can capture an
unlimited amount of text.
Q. How does that work? And do (have to keep an eye on
how much I have already captured?
A. When the text buffer is full the stop character is output to
the other system. Then DATA CAPTURE 4.0 writes vAyat
has been captured up to that point to a disk file. This is
done automatically.
Q. Then wtiat happens?
A. Control is returned to you and you can send the start
character to the other system. This generally requires
pressing any key, the RETURN key or a Control Q.
Q. Are upper and tower case supportad Iff have a Lower
Case Adapter?
A. Yes. If you don't have Itie adapter an upper case only
versk)n is also provided on the diskette.
Q. Do I need to have my printer card or Micromodem ir»
or Communteations Card^ in any special slot?
A. No. All this is taken care of when you first mn a stwrt
program Id configure DATA CAPTURE 4.0 to your system.
Then you don't have to be concerned with it again. If you
move your cards around later you can reconfigure DATA
CAPTURE 4.0.
Q. Do I have to build a file on the other system to get it
sent to my Apple?
A. No. If the other system can list it you can capture it.
Q. How easy is it to transmit text or data to another
system?
A. You can toad the text or data into DATA CAPTURE 4.0
from the disk and transmit it. Or you can transmit what you
have typed into DATA CAPTURE 4.0.
Q. How can I be swe the other system' recaivM what I
sandM?
A. If the other system works in Full Duplex, it 'ectnes' what
you send it, then DATA CAPTURE 4.0 adjusts its sending
speed to the other system and won't send the next charac-
ter untii it Is sure the present one has been received. We
call that 'Dynamic Sending Speed A(4ustm«if .
Q. What if the other system works only In Half Di^lex.
A. A different sendir>g routine Is pnnrided fcx- use with Half
Duplex systems.
Q. What if i WHit to transmit a program to tlie other
system?
A. 1^ prot>lem. You make the program into a text file with a
program that is provkJed with DATA CAPTURE 4.0, kied ft
into DATA CAPTURE 4.0 and fransmtt it
A.
Q.
A.
O.
A.
What type flies can I read and save with DATA
CAPTURE 4.0?
Any Apple DOS sequential text file. You can create and
edit EXEC files, send or receive VISCIALC© data files.
send or receive text files created with any editor that uses
text files.
Can I leave DATA CAPTURE 4.0 running on my Apple
at home and use if from another system?
Yes. If you are using the Micromodem \f^ you can call
DATA CAPTURE 4.0 from another system. This is handy if
you are at work and want to transmit something to your
unattended Apple at home.
Where can i buy DATA CAPTURE 4.0?
Your local Apple dealer. If he doesn't have it ask him to
order it. Or if you can't wait order it directly from Southeast-
em Software. The price is $65.00. To order the Dan
Paymar lower Case Adapter add $64.95 and include tfie
serial number of your Apple.
If I order it directly how can t pay for it?
We accept Master Charge, Visa or your personal check.
You will get your order shipped within 3 woridng days of
when we receive it no matter how you pay for it. Send your
order to us at the address shown or call either of the
numbers in this advertisement. You can call anytime of
day, evening or Saturdays
Q. I bought DATA CAPTURE 3.0 and DATA CAPTURE 4.0
sounds so good I want this verskm. What do I do to
upgrade?
A. Send us your original DATA CAPTURE 3.0 diskette and
document^on, the $35.00 price difference and $2.50 for
postage and handling. We wW send you DATA CAPTURE
4.0 within 3 working days of receiving your order.
Q. What kind of support can I expect after I buy it?
A. If you have bought fnxnSoutiieastemS<rflware in the past
you know we are always ready to answer any questions
about our products or flow to use ttiem.
Requires DtSK li®, Apptesoft ll»and 48K of Memory
DATA CAPTURE 4.0©
Copyright© 1 980-Southeastem Software
■ Appla", Apple II Pki()>, Dnk n* and APPLESOFT IK* am (radanwrhs ol Appta
Compuw Company.
■ Mkramodam 11* la a tradamaik of O.C. HayM AaaDCHMaa, Inc.
' Viaicata^OipyrigW by SaRaiara Aita, he.
We wetcotne your personal
chedt. We also accept Visa and Master Charge.
Southeastern Software
Dept.MK
6414 Derbyshire Drive « New Orleans, 1^70126
504/246-8438 504/246-7937
No. 38 -July 1981
MICRO - The 6502/6809 Journal
■ f ■ 4,,«,'"»*«»W!
awl » I i « i ) "Si.
'*t\^'t'
m • ^ 't-
" "m ""' ' «
m m m m m M
..;^¥ w -w -^ -f^ —
' w <m m m- » m m w
^^^^
rJl^r
mk
i% ■■|„
.^IllpPfll^.,
'm 9-» '^ ''-^ «*
■j<'^
..i..r ■:•.
16K RAM EXPANSION BOARD
FOR THE APPLE II* $195.00
The Andromeda 16K RAM Expansion Board
allows your Apple to use RAM memory in place
of the BASIC Language ROMs giving you up
to 64K of programmable memory. Separate
Applesoft* or Integer BASIC ROM cards are no
longer needed. The 16K RAM Expansion Board
works with the Microsoft Z-80 card, Visicalc,
DOS 3-3, Pascal, Fortran, Pilot, and other
software. A switch on the card selects either
the RAM language or the mainboard ROMs
when you reset your Apple.
The Andromeda I6K RAM Expansion
Board has a proven record for reliability with
thousands of satisfied customers.
Now with One Year Warranty.
♦Apple II and Applesoft are trademarks.
ANDnOMEDA
Distributed By:
I COMPUTER
□ATA
SERVICES
INCORPORATED
P.O. Box 19144
Greensboro, NC. 27410
919 852-1482
P.O. Box 696
Amherst, NH. 03031
603 673-7375
MICRO - The 6502/6809 Journal
No. 38- July 1981
jTssssBaRBwrrfF"'^
NO. 38
JULY 1981
STAFF
Editor/Publisher
ROBERT M. TRIPP
Associate Publisher
RICHARD RETTIG
Associate Editor
MARY ANN CURTIS
Special Projects Editor
MARJORIE MORSE
Art Director
GARY W. FISH
Production Assistant
LINDA GOULD
Typesetting
EMMALYN H. BENTLEY
Advertising Manager
CATHI BLAND
Circulation Manager
CAROL A. STARK
Dealer Orders
LINDA HENSDILL
MICRO Specialists
APPLE: FORD CAVALU^RI
PET: LOREN WRIGHT
OSI: PAULGEFFEN
Comptroller
DONNA M. TRIPP
Bookl<eeper
KAY COLLINS
Sales Representative
KEVIN B. RUSHALKO
DEPARTMENTS
5 Editorial
6 Letterbox
25 Club Circuit
30 New Publications
91 PET Vet
99 Hardware Catalog
101 Software Catalog
103 Microbes and Updates
106 6502 Bibliography
111 Advertisers' Index
No. 38 -July 1981
JMCftO
THE 6502/6809 JOURNAL
ARTICLES
y AIM Memory Maps Greg Paris
' Find and use undocumented features
H O Function Input Routine for Applesoft . . Roy E.Myers, Wllliam Miller III
' ^ Input during program execution with this self-modifying subroutine
■I c Vector Calculations with a Microcomputer Peter a. kosm
' '-' Use vectors quickly and easily with your micro
p-| Phone Search Horst K. Schneider
^ ' Cross-linl< phone numbers with record numbers
07 It's Time to Stop Dreaming, Part 2 Robert m. Tripp
^ ' More information about the 6809
^q Expressions Revealed, Part .1 Richard c. viie, Jr.
^^ Scanning, parsing and translation of expressions revealed
fi-i Electronic Typing Program for the Apple Thomas d. Brock
^ ' Small word processor that edits one-line-at-a-time
81 An Introduction to Bit Pads Loren w. Wright
00 PET Interface to Bit Pad Peter coyie
00 Information on hardware and software implementation
07 Bit Pad Routines for AIM 65 Ralph 0. Erickson
O • Assembly language program to interface AIM to a digitizer
APPLE BONUS
00 Double Barrelled Disassembler David l Rosenberg
^^ Short utility that makes creating disassembly listings easy
07 Single-Drive Disk Back-Ups for Apple Sfeve Emmett
^ ' Back up a disk without worrying about files residing on it
A A Enhanced Input Routine Bruce a. Robertson
^ ' Put data into your program quickly and easily
AC Binary File Parameter List Clyde r. Camp
^^ List address and length of all binary files on a given disk
OSI BONUS
cc A Typewriter Bell for Your Microcomputer Charles l Stanford
^^ Hardware and software sound an alarm when you near the end of a line
fry Monobyte Checksum Dumper for C1 P Peter d.h. Broers
O • This utility provides fast tape I/O and checksum protection
79 Line Editor for OSI 540 Board e.d. Morris, Jr.
' ^ Elementary line editing functions for OSI computers with BASIC-in-ROM
7c Life in a Wrap-around Universe Paul Krieger
• ^ A novel variation on the old game
70 Step and Trace for C1 P m. Plot
• ^ A single step trace for BASIC programs
MICRO -The 6502/6809 Journal 3
HAVING FUN CAN PAY OFF
with the Lower Case +Plus by fazen
The Apple community's acceptance of the Lower Case
+ Plus has made the Lower Case -i-Plus the number one
selling lower case adapter on the marker foe the Apple
II. To thank all those who have supported us, Lazer
Microsystems is presenting the "Lower Case +Plus
software contest."
All you have to do is send us a game program
utilizing the on-board graphics character set. You could
win a Keyboard +Plus or our new Graphics +Plus if your
program is judged superior to the competition. Even if
you don't win a Keyboard +Plus or a Graphics +Plus, we
will return your diskette with copies of all the
programs sutxnitted, space allowing.
If you do not already own a Lazer Microsystems Lower
Case +P1US, it's not too late to get one. They're $69.95
and available at better computer stores everywhere. Or
you can order directly from Lazer Microsystems, but
hurry, the submission deadline is Sept. 30, 1981.
graphics
contest
by:
Pollow the sinple rules below and who
knows? You nay winl 1
1. All programs must be submitted on diskette.
2. Ko limit on the number of entries.
(Multiple entries should be submitted on
the same diskette.)
3. Lable the diskette with your Name, Address
and Phone •■
4. Include any instructions or documentation
necessary to operate the program with ease.
5. Programs must run in less than 4BK.
%, Programs should run under dos 3.2 -or- 3.3.
Lable the diskette as to which you used.
7. Programs must utllixe the Lower Case
+Plus's gra^iica font.
8. Programs may use joysticks or paddles.
9. All programs submitted will be placed in
public donain and donated to the
International Apple Corps.
* Lazec HlcroSystens is not responsible for
lost or damaged diskettes.
1791-G Capital
Corona, CA 91720
(714)735-1041
U ICRO - The 6502/6809 Journal
No. 38 -July 1981
About the Cover
.1 man wxi, OEUBFOH!
Jans, I i.'SBWB
couBusn ID aofitc.
<wi,sa8 If aK m ,
KJ
Real Estate
Pictured on this month's cover is the
historic Fiske House in downtown
Chelmsford, just down the block from
MICRO. The display shows one of the
ways that a microcomputer might be
used in the real estate business: to pre-
sent listings to potential buyers. In-
stead of requiring the buyer to look at
dozens or even hundreds of houses,
many of which are of absolutely no in-
terest, the buyer could answer a short
questionnaire detailing the type of
house, location, price range, bedrooms,
and other significant features desired.
This material then could be used to
match the houses on file and to present
only those houses for consideration
which had a reasonably high correla-
tion. In addition to listing the basic
facts normally found, the file could
contain a floor plan, as in the cover ex-
ample; a map showmg the location of
the house; a simulated "tour" of the
house; and other pertinent information.
jyOftOis published monthly by:
MICRO INK, Inc., Chelmsford, MA 01824 |
Second Class postage piid at:
Chelmsford, MA 01824 and Avon,
MA
02322
USPS Publication Number: 483470
ISSN: 0271-9002
Send subscriptions, change of address, USPS
Form 3579, requests for back issues and all
other fulfillment questions to
MICRO
P.O. Box 6502
Chelmsford, MA 01824
or call
617/256-5515
Subscription lates
PeiYeai
U.S.
$18.00
Foreign surface mail
$21.00
Air mail:
Europe
$36.00
Mexico, Central America
$39.00
Middle East, North Africa
$42.00
South America, Central Africa
$51.00
South Africa, Far East,
Australasia
$60.00
Copyright© 1981 by MLCRO INK,
Inc.
All Rights Reserved
MICftO
Editorial
An Important 18 Cent Investment
A frustration in publishing MICRO
arises from the fact that the information
flow is essentially uni-directional.
While a tremendous volume of material
goes out, only a trickle of information
comes back in. There is very little feed-
back from the MICRO readership to let
us know how we are doing. The letters
we get from individuals tend to focus
only on one or two points that are of im-
mediate importance to the author of the
letter. There is no regular channel for us
to obtain a broad-base tmderstanding of
who our readers are, what interests
them, what they do with their com-
puters, what they would like to do with
their computers, and so forth. To help
remedy this, we are taking a reader
survey. You will find the Reader Survey
Form inserted between pages 96 and 97
of this issue. The information received
in this survey wiU have a major in-
fluence on the directions which MICRO
takes in the near future. Therefore,
those readers who do take the time to
complete the questionnaire and spend
the 18 cents to retum it will have a great
influence on the magazine.
More on the 6809
It was with some tmcertainty that
MICRO decided to cover the 6809. I
thought that some readers might be
upset that MICRO would have anything
to do with any microprocessor other
than the 6502. So far, all of the response
has been positive. Several long-time
subscribers have contacted me to say
that they discovered the 6809 over the
past year, are very happy with it, and are
glad to see MICRO cover it. A number of
people at the recent Applef est in Boston
expressed interest in the 6809 and
wondered how it might affect the Apple.
A couple of 6809 experts have contacted
me about providing articles for MICRO,
so there should be a significant increase
in the quality and quantity of material
in future issues.
I freely admit that I am a novice on
the 6809. To date I have written only
one minor program, hand assembled, for
the 6809. Therefore, the material that I
am presenting in my series is only to be
taken as a basic introduction to the
device, as seen through the eyes of a
6502 devotee. The material from the
6809 experts in future issues will cover a
wider variety of topics in greater depth.
If you are knowledgeable of the 6809,
please consider sharing yomr knowledge
with us. I would be happy to discuss
possible articles with you by letter or
phone.
The more I investigate the 6809, the
more I like it. There are little things
such as the two-byte addressing which
is the natural high-byte/low-byte form
(12 34) instead of the reversed form used
by the 6502 (34 12). There are more
significant improvements such as the
16-bit operations. And, there are major
effects, such as greatly increased
transportability of code. Since the 6809
does not make special use of page zero or
page one, it eliminates one of the major
areas of contention that one encovmters
when trying to make 6502 code general.
When I wrote a program to support a
video board on the AIM, SYM and KIM,
I kept r unning into problems of page
zero and page one usage. Since each
machine had allocated different sections
of these limited memory resources, it
became impossible to find any locations
which were universally free. This type
of memory contention would simply
not occur on the 6809.
Of even greater significance to
making code transportable is the 6809' s
inherent position-independent code
capability. There are several companies
which offer complete disk operating
systems for the 6809 which can be fairly
easUy adapted to any 6809-based
system. Once the particular 6809-based
operating system is installed, a large
number of packages are commercially
available. These include BASIC, Pascal,
FORTH and other languages; word pro-
cessors, assemblers, editors and other
"tools;" and a variety of business-
oriented applications. This means that
many new 6809-based computers can be
designed and built that can take advan-
tage of common software. This should
encourage programmers to write tmly
vmiversal software packages for the 6809
and perhaps eliminate the "Tower of
Babel" that has evolved within the 6502
world, where almost every program is
specific to a single microcomputer.
r
./oAt^
^•C^
No. 38 -July 1981
MICRO - The 6502/6809 Journal
JMCQO
Letterbox
Dear Editor:
I have both good news and bad news
for MICRO readers. The good news is
that the 6516 will shortly be available
for purchase by the public. The bad
news is that it is a 16K CMOS RAM
made by Harris.
Rats!
Hal W. Hardenbergh, President
Digital Acoustics, Inc.
1415 E. McFadden, Suite F
Santa Ana, California 92705
Deiir Editor:
This is a reply to the anonymous
letter in the May issue of MICRO
(36:16). I am one of those "skinflint,"
"bare-board" KIM-1 users and I think
this is a typical reply from all of us
' ' unintelligent, " " not-so-serious, ' '
"impoverished single-board" users
who read MICRO.
Since purchasing my KIM-1 a few
years back, for a paltry two hundred
and fifty dollars, I have added the
following:
Three Memory Plus boards with PROM
and RAM
One Mother Plus board
One case for the KIM-1 |no longer a
"bare-board")
Three power supplies
One Micro- Ade package (assembler-
disassembler-editor)
One Microsoft 9K BASIC package
One Tiny BASIC package
One printer
Two cassette drives
One ASCn keyboard
One video terminal board
One video monitor
Twelve EPROM chips at $50 each
One extended monitor package
One information retrieval package
One logic probe
One stringy floppy or regular floppy
(tentative)
One 4800 baud tape interface board
One tape management system package
One subscription to MICRO magazine
One subscription to COMPUTE
magazine
One EPROM eraser
I think the Editor of this magazine
will recognize a lot of "familiar" pro-
ducts in this list.
My point is this. Before you Johnnie
"Appleseeds" and the like shoot off
your mouths about us "impoverished,
Ijare-board users," it would do well for
you to investigate just who supports
the small-user industry.
The products on my list came from
various manufacturers, not just one,
who all advertise in magazines such as
MICRO.
If you want the "Black Box" con-
cept (it doesn't take a lot of intelligence
or sophistication to operate a "black
box") that is your business, but don't
force your snobbish attitudes on
everyone else....
I work with black boxes at work all
day long (Data Generals, Harris
Slash/7, MACSY M-2, etc.), but after
work I want to delve into something a
little more challenging and rewarding.
In other words, I like to do it "my way."
A "skinflint KIM-1 user"
from St. Louis, Missouri
Dear Editor:
Enclosed is an Apple tip that I think
might be of interest to the readers of
your magazine. In order to make some
types of programs easier to find in your
catalog, the type name can be changed
to another character. For example, the
'B' in binary programs may be changed
to a 'flashing B'. The 'T', 'I' and 'A'
may also be changed to any ASCII
character. Refer to the Apple manual,
page 15, for a table of ASCII characters.
Here are the POKEs.
POKE 45191,?
(Change T in text files)
POKE 45992,?
(Change I in integer files)
POKE 45993,?
(Change A in Applesoft files)
POKE 45994,?
(Change B in binary flies)
Example:
POKE45994,66 Changes 'B' in
binary file to 'flashing B'
If you initialize any disk after mak-
ing these POKEs they will have the
changes written in their DOS per-
manently. For a 32K system subtract
16384 from the above POKEs.
Dean Kay
P.O.Box 3984
Irving, Texas 75061
Dear Editor:
Allow me to relate my experiences
with a genuine software thief and his
immediate victims. An ad appeared
locally offering Apple PIE or Easy-
writer for $50 (vs. $130 and $100 list
price). I called the number given and
asked the man if he had VisiCalc, too.
He did indeed... for $40 (vs. $150 list)!
He went blatently on to tell me that it
was a copy, that I could make my own
backup disks and that the documenta-
tion was photocopied. "Do you
realize," I asked him, "that you're a
thief?" A pause... "Yeah," he said. I
hung up in his ear.
If you look out your window and see
someone picking the lock of your
neighbor's car, would you turn away? If
you feel a pickpocket's hand in your
own pocket, do you just stand there? A
software thief is no better than a car
thief or a pickpocket. If we, the users
and producers of software, prove unable
to police ourselves there will surely be
someone happy to do it for us. Uncle
Sam will have his heavy finger on your
keyboard and his beady eye on your
disks. We'll all be saddled with yet
more Big Brother government, em-
powered to watch our every software
purchase and sale. And who will pay for
this watchdog bureaucracy? You will. I
will. Every person and company in the
United States will pay for it with their
taxes. Is that what this thief wanted?
Or was he just too stupid to think?
So I phoned Personal Software, Inc.,
(about VisiCalc) and Programma Inter-
national [about Apple PIE). (1 would
have called Easy- writer's manufacturer
but I had no company name or phone. ) I
talked to the highest-ranking managers
there and told them of the thief. Both j
men were shocked. Perhaps these calls \
(Continued on page 18}
MICRO - The 6502/6809 Journal
No. 38 -July 1981
ftl-i
r
AIM Memory Map
This article describes how
a ROiVI-based assembier worlcs,
with detailed instructions for
getting at several useful, but
undocumented features,
including new .OPT functions
for the AIM.
Greg Paris
11-2A English Village
Cranford, New Jersey 07016
The AIM 65 assembler was designed by
Compas Microsystems [the makers of
the AIM monitor) to be a subset of its
larger, RAM-based A/ 65 assembler. In
fitting the AIM asse:mbler into a 4K
ROM, several features of the A/ 65
assembler had to be dropped. What re-
mains, however, is an extremely useful
program to be resident in one's AIM,
even if it doesn't list a sorted symbol
table or coimt lines of program listing.
I wanted to see if I could extend the
AIM assembler's command, set through
a conveniently-placed zero -page RAM
hook or vector. I found out quickly that
I could not. But in the process of line-by-
line decoding, I found many other things
of interest — some useful subroutines
which can be called from outside the
assembler, and several hidden shortcuts
and imdocumented functions. This arti-
cle will provide a memory map of the
AIM 65 assembler FLOM, describe its
operation and use of RAM, and detail
these imdocvmiented features.
The Assembler Disassembled
Table 1 shows how the assembler is
organized into a 4K block of memory
which starts at $DOO0. Most of the look-
up tables are found near the upper end of
this block, which allows the majority of
the program from $E<XX) to $DD4A to
be disassembled continuously by use of
the AIM monitor command "K". If you
do it for yourself, it's best to dis-
assemble oiily 1 to 2 pages of memory at
a time, to prevent your power supply
from overheating any more than it
usually does.
Tab/e 1: Assembler ROM Memory Map
D6CE - SBR - increment line
pointer, then
D6D0 - D6E7 SBR - get first non-
DOOO - DODF
initialize RAM and semp
space character to begin
for PASS I
string
DOEO - DOES
loop to process lines of
D6E8 - D71F SBR - get last character
source code; stack reset
in a string; ignore
each time
between quotes
D0E9 - D66E
SBR - PROCESS a
D720 - D74A SBR - look for ),
line... includes:
comma, space or end-
D104
..get a line from AID;
of-line [EOL)
echo to display
D74B - D75B SBR - output the buffer
D128
..separate labels from
to LIST-AOD until
mnemonics and
quote or EOL
operands
D75C-D767 SBR - carry set if
DIDB
..reassign program
alphabetic character
coimter or PC (*=)
D768 - D773 SBR - carry set if
DIES
..process an equate ( = )
numeric character
D259
..directive (,XXX)
D774 - SBR - set A = 3, then
decoding; then jump-
D776 - SBR - store A as
indirect to do it
number of characters,
D299
..encode data as per
then
.BYT, .WOR, .DBY
D778-D796 SBR - transfer
instructions
characters from text
D346
..check and assign
buffer to SEARCH
.BYT data in ASCE
buffer
literal format
D797-D8AC SBR - EVALUATE an
D396
..decode .OPT XXX;
expression..., includes:
then jump-indirect to
D7B9 ..select low byte of
doit
symbol (<)
D3B3
..set up directive flag
D7C1 ..select high byte of
variable ($37)
_ symbol [>)
D3CC
..do .OPT SYM, NOS,
1 D7D4 . .decimal number
NOC, CNT, and COU:
string
i.e., nothing!
^
D7DA ..hex niunber string ($)
D3D4
..perform .SKI
D7E0 . .octal munber string
D3DE
..perform .END; setup
for PASS 2
(@)
^ D7E6 . .binary number string
D414
..toggle tape recorders
(%)
while waiting for PASS 2
— ^et up to convert to a hex number
D43E
..setup FNAMEfor
(.DBY format)
D454
D66F - D68F
tape file for PASS 2
..encode mnemonic/
symbolic address into
opcode/operand
SBR - do list of line and
preset ERROR
statement; then NEW
line
execute .FIL if AID =
TorU
perform .PAG
SBR - get beginning-of-
D7E8 ..get symbol value
with SEARCH
D81D ..evaluate current
pointer or PC (•)
D858 ..perform 2-byte
addition [ + )
D886 ..perform 2-byte
D690
subtraction ( - )
D8AF - D8C2 SBR - test flag from
D69D
D6CA-
EVALUATE for
arithmetic error and
line pointer, then
ovemow icondnued)
No. 38 -July 1981
MICRO - The 6502/6809 Journal
There are several directives and
"list" options which are supported by
the assembler. The recognition process
requires that a list of these commands
(in ASCn) be present in ROM to be scan-
ned as necessary. This list, and the action
address for each command, are shown in
table 2. I noticed that there were more
options Usted in ROM than I had ever
seen described. As I will detail later,
there is a new pair of options which aie
supported — .OPT MEM and .OPT
NOM — and several which are recog-
nized (i.e., not rejected outright with
"**ERROR 14"! but simply ignored.
A memory map of any program is
only of limited usefulness if its con-
stants and variables are not well-
documented. Table 3 shows how the
assembler utilizes zero page RAM, and
the functions of most of these addresses,
or their contents. In addition to this zero
page use, a section of page one, just
below the stack area, is reserved for the
temporary storage of compiled opcodes
and data. Several addresses vie for the
most-used-zero-page-address award, but
the winners are $46 -H (the text input
buffer starting address), $35 (the length
of the ciurent line in said buffer), and
$29 (the pointer to the active character
in this buffer, a single byte usually
stored here from the X register.)
How It Works
The following description will be
most informative if the disassembled
object code is available, if for no other
reason than to see how some of the
tricks are accompUshed with minimal
coding. But it's not absolutely necessary.
All the real work of assembly is
directed from the subroutine at $D0E9 -
$D66E, which I've labeled PROCESS.
The section immediately preceding this
(from $DOEO - $D0E8) is a small loop
which calls PROCESS each time a new
line is to be processed. This loop does
only two things: resets the stack
pointer, and calls PROCESS. All other
subroutines are called from PROCESS.
If it becomes necessary to leave
PROCESS because of some fatal process-
ing error, even if the stack pointer is ran-
domly set, there is no problem because
exit always occurs after the stack
pointer is partially reset. This allows an
RTS instruction to return control to the
small loop. (See $D686 -$D688 for how
this is done.)
The assembler itself has very few
functions: get some text; try to assemble
it; check for errors; and output the
results. The actual processing is almost
as simple as the statement.
Table 1 (Continued)
D8C3 - D8DA
D8DB - D8EC
D8ED
D94F-
D956-
D95E-
D9A2-
D9D4
D9EA-
DAOC
D94E
D955
D95D
D9A1
D9D3
D9E9
DAOB
DAOF - DA5D
DA5E - DBC6
DA7E
DA90
DAAO
DAC3
DADO
DB19
DB62
DBB2
DBC7 - DBEC
DBED
DBEF-
DBF8-
DBFA-
DC05
DC06
DC09
DC29
DC28
SBR - get ciurent
character with X
register as pointer; also
check for end-of-
symbol
SBR - get opcode
addend from table
SBR - base conversion
SBR - test for carry
from previously
performed add/subtract
TABLE - constants for
base conversion
SBR - SEARCH symbol
table for entry
SBR - STORE symbol
and value in table
SBR - if string =
mnemonic, get opcode
data
SBR - find mnemonic
SBR - set flag for no-
error/ list-line-only ,
then
SBR - decode error
number, select LIST or
not
SBR - LIST a line to
LIST-AOD and output
OBJ code to OBf-AOD,
followed by •*ERROR
XX, if needed...,
includes:
..determine if PC needs
to be output
..output PC at
beginning of line, then
..output label if one is
present
..recalculate when next
PC armouncement is
due
..output
opcode/ operand or data
..output rest of line
..format quotated
strings
..finish output line;
return for more data if
.OPT GEN selected
SBR - output an error
message and number;
increment error count
SBR - set A = 1, then
SBR - add A to PC,
then
SBR - zero A, then
SBR - add PC to A
storing result as
memory deposit
pointer
SBR - output single
byte to OBJ-AOD
SBR - output byte as 2
ASCn hex nmnbers to
OBJ-AOD
SBR - add opcode to A,
then
DC2E - DC4D SBR - output A to
memory, or to OBJ-
OUT intermediate
buffer
DC4E - SBR - move from
intermediate buffer to
OBJ-OUT buffer, then
DCA9 - DCB7 SBR - clear OBJ-OUT
intermediate buffer
DCB8 - SBR - zero and start
OBJ-checksum
calculation, then
DCC8 - DCDl SBR - add A to OBJ-
checksum
DCD2 - SBR - format and
output an OBJ-code
record, then
DD02 - DDOC SBR - CRLF to OBJ-
AOD
DDOD - DD4A SBR - format and do
last OBJ-record; close
tape file
DD4B - DD74 TABLE - assembler
directive action
addresses (.WOR
format)
DD75 - DDB3 TABLE - assembler
directives and .OPT
list, in ASCn
DDB4 - DE5B TABLE - mnemonic
list, in ASCn, in
alphabetic order
DE5C-DE65 TABLE - allowed
opcode addends
DE66 - DE74 TABLE - look-up index
to reference table
$DE75
DE75 - DEDD TABLE - look-up legal
operand format
DEDE - DF15 TABLE - opcode
classification list
DF16-DF4D TABLE - basal
opcodes; in same order
as mnemonics
DF4E - DFA2 TABLE - messages, in
ASCII; each one ends
with a semicolon
DFA3-DFA7 TABLE - reserved
labels, in ASCD:
"AXYSP"
DFA8 - SBR - set up display
and monitor with
FNAME of .FIL, then
DFCC - DFDC SBR - go get file if AID
= TorU
DFDD - DFE8 SBR - print a message;
input in X = offset of
beginning of message
from $DF4E
DFE9 - SBR - output a blank
space, then
DFEC - DFF5 SBR - output a CRLF
toAOD
DFF6 - DFF9 ??TABLE?? - four
unidentified bytes...
DFFA - DFFE SBR - output space to
AOD
DFFF "N" in ASCn: the
monitor command to
jump to the Assembler
MICRO - The 6502/6809 Journal
No. 38 -July 1981
Table 2: Assembler Directive end Option
Mnemonics
Location of
Action
First Byte
Mnemonic Address
(hex)
DD75
BYT
D299
DD78
WOR
D2A1
DD7B
DBY
D29D
DD7E
SKI
D3D4
DD81
PAG
D69D
DD84
END
D3DE
DD87
OPT
D39D
DD8A
FH,
D690
DD8D
GEN
D3B3
DD90
NOG
D3B7
DD93
SYM-l
DD96
NOS
DD99
NOG
D3CC
DD9C
CNT
(unsupported)
DD9F
cou-J
DDA2
ERR
D3BB
DDA5
NOE
D3BF
DDA8
MEM
D3C8
DDAB
NOM
D3C4
DDAE
US
D3BF
DDBl
NOL
D3BB
Input text is obtained from the AID
as specified by the monitor variable IN-
FLG (which also allows input directly
from memory) in a loop from $D104 -
$D127. Output, on the other hand, can
be two-fold: actual object code (the real
reason for using this program, after all)
and a formatted assembly listing. These
must go to two different devices, and a
significant portion of the assembler is
devoted to the proper formatting of the
listing ($DA5E - $DBEC) and to the pro-
duction of a formatted standard object
code ($DBED - $DD4A). If the object
code is to go directly to memory, no for-
matting into a record is performed, and
the code is merely deposited (at step
$DC3C) as per the pointer in $09/0A.
The assembly itself is done as
follows. The input line is first parsed in-
to labels, mnemonics or assembly direc-
tives. Any string that does not meet
these criteria is rejected with error
numbers 3, 8, 9, 10, or 20. Directives are
processed by the section which starts at
$D259; the jump-indirect to the specific
address is taken only after the directive
in the text is compared with those com-
mands supported (see table 2) and the
proper action address is obtained from
the table at $DD4B. Any errors in this
process are called "undefined assembler
directives." When a directive has been
performed and listed (if desired), exit to
the small loop at $DOEO occurs.
Those strings which are used as sym-
bolic constants or address labels are dif-
ferentiated from mnemonics by length.
or by a mnemonic scan called from
$D167. Labels may be associated with
equates, or with the current program
coimter address (PC). On the first pass,
if the string is legal and not a
mnemonic, it is assigned a value and
placed in the symbol table with this
value by the subroutine called from
$D1CF. If the string is found to be a
mnemonic, a branch occurs to that sec-
tion of the assembler which performs
the actual opcode assembly calculations.
The opcode compiler starts at $D454
and is the heart of the assembler. First
the mnemonic is checked against a list
in ROM, which starts at $DDB4. Like
the directive list, this list is in ASCII,
and is conveniently arranged alpha-
betically. Then, two new bytes of infor-
mation are obtained using the position
of the mnemonic in the Ust as an index.
The table which starts at $DF16 yields
the "basal opcode." This is a single byte
which represents the lowest nimieric
value of the opcodes allowed for a given
instruction, to which a constant deter-
mined by the assembler may be added.
And the table at $DEDE yields the op-
code classification type. How do these
two bytes determine the actual opcode?
If you look at the allowed instruction
set for the 6502, you wUl see that not
only does it contain holes (not all in-
structions use all addressing modes) but
there is some pattern to these holes.
Various mnemonics can be grouped
together by considering which modes
are allowed for each. Table 4 shows how
this classification scheme is im-
plemented. What the assembler does in
the opcode compiling section is to sort
out the requested mode, and give errors
if this disagrees with those allowable
modes obtained from table $DEDE.
Then it evaluates the expression which
is the operand [if any) and does the
following calculation (more or less):
basal opcode + (addend from table
$DE5C X factor Q) = opcode for the
desired addressing mode.
"Factor Q" is determined when the
syntax of the operand is checked. It
takes into account such things as
whether the address is page zero, or
whether the mode is implied, indirect,
indexed, etc. If your somce code can run
this gantlet, it is assembled.
One concept simplifies the control of
much of the operation of the assembler
— flag variables. Several page zero loca-
tions store information which is used
repeatedly to direct operations: loca-
tions $21 - $23, and $36 - $38. Of central
importance is the directive flag, $37.
Three of its bits are used to store the
status of various selected options and
allow this status to be tested frequently
during assembly. Table 5 details how
the bits of this variable are understood
by the assembler. This variable will also
be of importance later in the discussion
of the undocumented .OPT
MEM/NOM functions.
There are few differences between
PASS 1 and PASS 2. During the first
pass, any output is swallowed by the
program instead of being directed to the
printer or OBJ-OUT device. The symbol
table is compiled dviring the first pass,
and is used extensively in the second
pass to evaluate expressions. The
distinction between each pass is signal-
ed by the PASS 1/2 flag — $23.
Undocumented Features
This is probably the section you
turned to first! Here I'll describe those
. assembler functions which haven't been
detailed in the AIM manual, including a
few shorthand notations, a built-in
routine which allows the user to toggle
tape recorders on and off while waiting
for PASS 2, and several vmdocumented
.OPT functions, especially two which
are supported but not described in the
manual.
1. I found three shorthand techni-
ques that are allowed by the assembler.
First, the indexed indirect addressing
mode can be written either as LDA
(VAR,X) or LDA (VAR,X with no closing
parenthesis. Second, the indirect index-
ed addressing mode can be written
either as LDA (VAR),Y or LDA (VAR)Y
with no separating comma. Third,
single-byte ASCII literal operands may
be denoted in two ways: CMP #'X' or
CMP #'X with no closing quotation
mark. This last shorthand is not ex-
plicitly stated in the AIM manual, but it
is used as an example on pg. 5-19 (rev
3/79). These shorthand methods save
one shifted keystroke per operand. Note,
however, that .BYT 'XXXXXXX' still re-
quires a closing quotation mark.
2. If you have ever assembled from a
source file on a tape cassette under
remote control, you will have noticed
one inconvenient operating detail: while
the assembler waits to do PASS 2, the
remote line shuts off your recorder!
Before the tape can be rewound, you
have to manually override this control,
and, for example, disconnect the remote
plug. But no more! The capability to
toggle the tape remote control is already
a part of the assembler. Here is how it
works.
r
No. 38 -July 1981
MICRO - The 6502/6809 Journal
Tabl9 3: Assembler RAM Usage
(00^03) (not used)
04 number of bytes in data or
opcode/operand at SBR
$DAOF
(05) (not used)
06/07 .WOR— temporary storage
of program counter (PC)
08 error index at SBR $DA0F
09/OA .WOR— pointer used to
store OBJ code in memory
OB/OC .DBY— number of entries
in symbol table
OD/OE .WOR— directive action ad-
dress or SEARCH address
OF basal opcode stored here
10 opcode classification type
(see table 4); or $E if
branch
11/12 .WOR— symbol coimter for
SEARCH
13/14 .DBY— value of symbol; or
workspace for * assignment
15 +or - sign for EVALUATE
16 same as 04, but maximum
value allowed is $14
17/18 parameters for BASE con-
version; loaded from table
at $D956
19 nimiber of bytes in com-
pleted .BYT ASCn literal
string; or flag for format-
ting quotated material for
LIST
lA/lB .DBY— niunber of errors in
PASS 2
allowable operand coding
key
ID expression OK/NOK flag
used in opcode processing
error number (in decimal)
for to print "ERROR XX
output line coimter for
LIST formatting
flag: "this line contains a
label"
flag:"* = "
flag: used to select .DBY,
.WOR, .BYT notation
pass coimter: PASS 1=0;
PASS 2=1
pointer to next non-space
character in buffer
pointer to last character of
string in buffer
number of characters in
string
.DBY— output of
EVALUATE = value of ex-
pression
pointer to active character
in buffer
string storage for com-
parison by SEARCH
number of bytes compiled
at SBR $D66F et al.
stored enor nvunber at SBR
$D683
IF
20
21
22
23
24
25
26
27/28
29
2A--*2F
30
31
32/33 .WOR— program coimter or
PC
34 display buffer pointer
35 number of characters in
current line in buffer
36 flag: for> or < operations
37 flag: directive/option status
(see table 5)
38 flag: arithmetic over- or
under-flow from
EVALUATE
39 number of bytes ( .BYT = 1;
.WOR and .DBY = 2)
3A/3B .WOR— symbol table start
3C/3D .WOR— last active symbol
3E/3F .WOR— symbol table upper
limit
40/41 .WOR— OBJ output record
counter
42/43 .DBY— OBJ record
checksum
44/45 .WOR— address at which
PC is next due to be
LISTed
46-3»81 input buffer; usually uses X
as index/pointer
82/83 workspace... various uses
84 index/pointer for OBJ in-
termediate buffer
85/86 used in OBJ output process-
ing: absolute address of
where data would be
deposited if not stored in
intermediate buffer
87 OBJ-OUTFLG, if defined
88 LIST-OUTELG stored here
when OBJ is being output
89-*A6 record assembly space for
OBJ output... includes:
89 number of bytes in record
8A/8B starting address of data
8C-»A2 data
A3-A6 checksum
A7-*AB AID input FNAME stored
here
0170-0183 intermediate storage buffer
of compiled object code
Assume that PASS 2 has been
displayed, and that the assembler is
patiently waiting for you to press
"space" to initiate the second pass. In-
stead of "space", press "1" or "2",
depending on which line is coimected to
your recorder. Voila, your recorder is
now nmning. Rewind to the start of the
fUe, toggle "1" (or "2") again if you
wish, start the recorder, and then press
"space" on the keyboard. It's as easy as
that.
3. Now to the undocumented op-
tions. You may have noticed in table 2
that several assembler mnemonics were
unfamiliar. Indeed, MEM and NOM are
supported, and I'll discuss them in the
next paragraph. But the options SYM,
NOS, NOC, CNT, and COU, while
recognized, are not supported. Their
action addresses direct processing to
null place in the program so their incli
sion doesn't crash the assembly, bu
merely is ignored. I assume that thes
are fossUs which remain from the core
mand set of Compas Microsystem'
larger A/65 assembler. With tha
assumption, some of their functions ca
be guessed at: SYM/NOS toggled th
printing of a sorted symbol tabic
NOC/CNT probably determine
whether each line of the formatte
assembly listing was sequential!
numbered; and COU probably set th
number of lines per page. Note tha
there is room in the directive fla
variable for, at most, 5 more statu
toggles than are used by the AIA
Assembler.
4. .OPT MEM / .OPT NOM doe
work, however. Its syntax is like that c
other .OPT commands, and the optio]
determines the status of bit 3 in th
directive flag. (See table 5.) This optioi
allows the user, for whatever reasons, ti
choose exactly when and where th
object code will be directed durin,
assembly. As with other options, use o
an .OPT command overrides thos-
parameters determined during th'
initialization dialog. But this mean
that if .OPT NOM is to be use(
somewhere in the source text, the use
must teply "Y" to "OBJ?" during th
dialog, and then specify the OBJ-OLT]
device to insure that the OBJ-OUTFLC
will be determined before it is needed
Thereafter, .OPT MEM and .OPT NO^
will allow object code to be directed t(
this device as desired during assembly o
the source program.
I have even found a few usefu
subroutines that can be called from out
side the assembler. Some of these an
described in detail in table 6. 1 especially
like the subroutine which converts fron
multiple base systems to hex notation
Although it cannot be incorporatec
directly into a USR function and callec
from a BASIC program because of zen
page RAM conflicts, the concept can be
used by anyone to provide a simple basi
conversion function in BASIC.
Finally, a word of warning to an]
reader who may want to relocate th<
assembler. Disassembling this progran
into a source file cannot be done blindly
Various changes must be made manual
ly. These are summarized in table 7. I
these suggestions are followed, an)
planned reassembly should proceec
smoothly.
MICRO - The 6502/6809 Journal
No. 38 -July 1981
Tablo 4: Opcode classifications from table
$D9DF
Table
Entry Class of Opcodes
Bit
Number
Table 5: Directive Flag Variable ($37)
Used For
r
.OPT If
Bit Is SET Bit Is CLR
01
02
03
04
05
06
07
08
09
OA
OB
OC
14
15
widest variety of
operaiid type allowed
(as for ADC, LDA,
etc.)
STA
JMP, direct or indirect
JSR
accumulator mode
allowed (as in LSR)
CPX,CPY
BIT
LDY
STX
STY
LDX
DEC
single bytes (accumu-
lator mode not allowed)
(as in SEC or TAY)
all branches
7
generate complete data
for .BYT command?
NOG
(no)
GEN
(yes)
'}
(not used)
J
output a complete
assembly listing or
errors only?
/"err")
\_nolJ
(errors
only)
fNOE'l
\_US J
(complete)
3
1}
object code to memory
NOM
(no)
MEM
(yes)
(not used)
s
Table 6: Useful Subroutines: I/O formats, RAM and register usage.
Greg Paris has been doing postdoctoral
research in neurobiolog;)?, and has turned
his hobby into a job — as Senior
Applications Specialist at Merck
Pharmaceutical Co. He interfaces between
the research scientists and the
programming and design staff.
JMCRO
SBR
entry
address Function
Input
Output
RAM used,
Flags Regis- including
upon ters that of
exit altered called SBR's
D797 EVALUATE an
expression
D8ED BASE conversion
D95E
SEARCH for
symbol table
entry
D9A2 STORE symbol
and value in
table
pointer to
beginning of
expr in 46,X
pomter to
beginning of
string in
46,X
label in
$2A +
value in
A/MSB and
Y/LSB
symbol in
$2A +
value in
27/28
(if done)
hex value
in 13/14
AXY
AXY
test $38
.and.
Y = 0, lor 2
0: not done
1: no symbol
found
2: OK
SEC if OK
CLC if not
possible
.also,
test $38
value in SEC if OK AY
13/14, CLC if not
if found found
if no room, A Y
Assembler
auto-
matically
restarts
13/14
15 16
17/18
27/28
32/33
35 36 38
82/83
13/14
16 17/18
35 82/83
38
OB/OC
11/12 13/14
2A +
3A/3B
~3C/3D
OB/OC
13/14
3C/3D
3E/3F
Location (Hex)
Table 7: Disassembly Precautions
Content Status
D956-D95D
DD75-DFA7
DFF6-DFF9
position-independent data no change necessary
D000-D955
D95E-DD4A
DFA8-DFF5
DFFA-DFFE
program segments
although relative branches
remain intact, all absolute
addresses in the range
$D000-DFFF must be changed
DD4B-DD74
D27C-D27F
D3AA-D3AD
D9D4-D9D7
action addresses for
directives (.WOR)
these are MSB/LSB bytes
of position-dependent
address used as input to
SBR $D9EA in registers
AandY
all must be changed
change LDA#
and LDY#
operands to
reflect new addresses
No. 38 -July 1981
MICRO - The 6502/6809 Journal
11
SOFTWABE UNLIMITED
presenting the LARGEST SELECTION OF SOFTWARE EVER ASSEMRLED.
for ATARI® • APPLE® • PET® • and other Microcomputers
at SUPER DISCOUNT PRICES!
ATARI
D ATARI 800 COMPUTER 775.00
a ATARI 400 COMPUTER 375.00
a PHYSICS (AT) 24.50
D GREAT CLASSICS (AT) 24.50
D BASIC PHYSCOLOGY (AT) 24.50
D PRINCIPLES OF ECONOMICS (AT) . . . .24.50
D SPELLING (AT) 25.50
D BASIC ELECTRICITY (AT) 24.50
a BASIC ALGEBRA (AT) 24.50
D 32 K RAMCRAM (AT) 195.00
D KINGDOM (AT) 13.55
D STATISTICSI (AT) 17.95
a BLACKJACK (AT) 13.55
D BIORYTHM (AT) 13.55
D HANGMAN (AT) 13.55
a SPACE INVADERS (AT) 17.95
D EUROPEAN CAPITALS (AT) 13.55
a MORTGAGELOAN (AT) 13.55
D STATES t CAPITALS (AT) 13.55
D EDUCATION SYSTEM (AT) 22.50
a ATARI BASIC (AT) 53.95
a ASSEMBLER DEBUG (AT) 53.95
D BASKETBALL (AT) 35.95
D VIDEO EASEL-LIFE (AT) 35.95
n SUPER BREAKOUT (AT) 35.95
D MUSIC COMPOSER (AT) 53.95
D COMPUTER CHESS (AT) 35.95
a 3-D TIC TAC TOE (AT) 35.95
D STAR RAIDERS (AT) 35.95
D TELELINK (AT) 22.50
a PADDLES (AT) 17.95
D JOYSTICKS (AT) 17.95
D U.S. HISTORY (AT) 24.50
D U.S. GOVERNMENT (AT) 24.50
D SUPERVISORY SKILLS (AT) 24.50
□ WORLD HISTORY (AT) 24.50
D BASIC SOCIOLOGY (AT) 24.50
ADVENTURE INTERNATIONAL
D ADVENTURE HINT SHEET 7.95
a ADVENTURE (1 .2,3) (D) (AP) 35.95
D ADVENTURE (4,5,6) (D) (AP) 35.95
D ADVENTURE (7,8,9) (D) (AP) 35.95
a ADVENTURE #10 [D] 18.95
D ADVENTURE (specify 1-10) (AP,AT) 13.55
n PLANETOIDS [D] (AP) 17.95
D PLANETOIDS (AP) 13.55
D POKER (AP) 13.55
a POKER (AP) IDl 18.95
D KID-VENTURE »1 (AP) 13.55
D STARTREK3.5 (AT) 13.55
D MOUNTAIN SHOOT (AT) 8.95
D SUNDAYGOLF (AT) 8.95
D ANGLEWORMS (AT) 8.95
D DEFECTIONS (AT) '.8.95
D GALACTIC EMPIRE (AT) 13.45
AVALON HILL
D MIDWAY (P.AP) 13.50
□ NUKEWAR (P.AP) 13.50
D PLANET MINERS (P.AP) 13.50
D CONVOY RAIDER (P.AP) 13.50
D B1 BOMBER (P,AP) 13.50
O LORDS OF KARMA (P.AP) 18.00
D CONFLICT 2500 (AP,AT,P) 13.50
D COMPUTER ACQUIRE (AP,P) 18.00
AUTOMATED SIMULATION
D TUESDAY QUARTERBACK [D) (AP) 26.95
D STAR WARRIOR [C,D1 (AP) 35.95
D THREE PACK (D] (AP.P) 45.00
D STABFLEET ORION |C,D) (AP) 22.50
D STARFLEET ORION [C] (P) 22.50
a INVASION ORION ICDl (AP) 22.50
D INVASION ORION [C] (P) 22.50
D APSHAI 1D| (AP) 35.95
D APSHAI (C) (P) 35.95
Check program desired.
Complete ordering inlormatian
and mall entire ad.
Immediate Shipments from stock.
r
KEY:
AT-Atari
AP-Apple
P-Pet
D-on Disc.
C -Cassette
If not marked-Cassette
ATARI is a trademark of ATARI INC.
APPLE is a trademark of APPLE COMPUTER. INC.
PET is a trademark of COMMOOORE BUSINESS MACHINES.
V Prices subject to change without notice.
%_ ^
AUTOMATED SIMUUTION
D RYN ID.C) (AP) 17.95
a RYN ICl (P.AT) 17.95
D MORLOC [CDl (AP) 17,95
D MORLOC [C| (P.AT) 17.95
D RIGEL (C.D) (AP) 26.95
D RIGEL [C] (P) 26.95
D HELLFIRE [D] (AP) 35.95
D HELLFIRE |C] (P) 35.95
QUALITY SOFTWARE
D 6502 DISASSEMBLER (AT) 10.55
D ASTRO APPLE (AP) 1355
DASTROAPPLE (AP) (D) 17.95
D ASTEROIDS IN SPACE [D] (AP) 17.95
n ATARI ASSEMBLER (AT) 2250
D BABBLE (AP) [D] 17.95
D BATTLESHIP COMMANDER (AP) 1355
D BATTLESHIP COMMANDER [D] (AP) . . , .17.95
D FASTGAMMON [D] (AP) 22.50
D FASTGAMMON (AP.AT) 17.95
D FRACAS ADVENTURE (AP) 1 7.95
D FRACAS ADVENTURE [D] (AP) 22.50
D LINKER (AP) [D] 4400
a TANK TRAP (AT) 10.55
DTANKTRAP (AT) [D] 13.55
D TARITREK (AT) 10.55
a TARI TREK (AT) (O] 13.55
D FORTH (AT) [D] 72.00
PERSONAL SOFTWARE
D CCAMGMT [D] (AP) 85.00
lyoESK TOP PLANNER II [D] (AP) . . . , 175,00
D ZORK (D) (AP) 35.95
D MONTY MONOPOLY [D] (AP) 31.55
D VISICALC [D] (AT,P,AP) 170,00
INSTANT SOFTWARE
D AIR FLIGHT SIMULATION (AP) 8.95
D APPLE FUN [D] (AP) 17.95
D CASINO (P) 7.25
D MORTGAGE (P) 7.25
DPADDLEFUN (D) (AP) 17.95
a PENNY ARCADE (P) 7.25
D SANTA PAHAVIA FIUMACCIO (AP) |D] . . , , 17,95
D SAHARA WARRIOR (AP) 7,25
D SKY BOMBERS (AP) [D] 17,95
D SPACE WARS (AP) 725
D SUPERSHOOTERS (AP) 8,95
STRATEGIC SIMUUTIONS
D COMPUTER AMBUSH [D] (AP) 51,50
a COMPUTER BISMARCK ID] (AP) 51,50
a COMPUTER CONFLICT |D] (AP) 35,00
□ COMPUTER NAPOLEONICS [D] (AP) ,.,,51.50
D COMPUTER QUARTERBACK [D] (AP) . . . . 35.00
D AIR COMBAT (D) (AP) 51.50
DWARPFACTOR [D) (AP) 35.00
D CUTHROATS & CARTELS [D] (AP) . . . , 35,00
D OPERATION APOCALYPSE [D] (AP) 51.50
QTORPEDOFIRE [D] (AP) 51.50
SUB-LOGIC
D 3DGHAPH1CS (AP) 40.00
DSDGRAPHICS (D) (AP) 48.00
D A-2-FS1 FLIGHT SIMULATOR (AP) 22.00
n A-2-FS1 FLIGHT [D] (AP) 29.00
MICROSOFT SOFTWARE
D ADVENTURE |D1 (AP) 25.50
n OLYMPIC DECATHALON ID] (AP) 20.00
a TYPING TUTOR (AP) [D] 17.95
D TYPING TUTOR (AP) 1355
D Z-80 SOFTCARD [D] (AP) 280.00
DiekRAMBOARD (AP) 165.00
ON UNE SYSTEMS
n HI-RES ADVEN. #0 (AP) [D] 17.95
D HI-RES ADVEN. #1 ID) (AP) 22.50
D HI-RES ADVEN. #2 (D) (AP.AT) 29,00
D HI-RES FOOTBALL #1 [D) (AP) 36.00
□ HI-RES CRIBBAGE [D] (AP) 22,50
n PADDLE GRAPHICS [D] (AP) 36,00
n TABLET GRAPHICS |D] (AP) 44,95
D MISSILE DEFENSE (DJ (AP) 26,95
n SUPERSCRIBE [D) (AP) 81.00
SIRIUS
n CYBER STRIKE (DJ (AP) 36,00
OSTARCRUISER [D] (AP) 22,50
a BOTH BARRELS [D] (AP) 22,50
D PHANTOM FIVE [D] (AP) 36.00
a SPACE EGGS (D) (AP) 26.95
SYNERGISTIC SOFTWARE
D DUNGEON & WILDERNESS [D] (AP) 29.00
D DUNGEON (AP) 13.50
D DUNGEON [D] (AP) 15.75
D ODYSSEY (D) (AP) 27.00
D HIGHER GRAPHICS (0) (AP) 31.50
D WILDERNESS (AP) 15.75
D WILDERNESS [DJ (AP) 18.00
D PROGRAM LINE EDITOR [D] (AP) 36.00
BRODERRUND
D GALACTIC EMPIRE (AP) [D] 22.60
D GALAXIAN (AP) [D) 22,50
DHYPERHEADON (AP) [D] 22.50
D GALACTIC REVOLUTION (AP) [D],,,, 22,50
D TANK (AP) ID) 13,65
D TAWALA'S REDOUBT (AP) jD) 26,95
D GALACTIC TRADER (AP) [0] 22,50
D PUCKMAN (AP) [D] 22,50
MUSE COMPANY
D ABM (D] (AP) 22,50
DAPPILOTII [01 (AP) 80.00
DBESTOFMUSE [D] (AP) 35,95
D GLOBAL WAR (D) (AP) 22,50
DSUPERTEXTII (D) (AP) 135,00
D THREE MILE ISLAND I D] (AP) 35,95
OU-DRAWII [D] (AP) 35.95
a THE VOICE [D] (AP) 35,95
IRIDIS
D IRIDIS 1 (AT) 8,95
D IRIDIS 1 (AT) [D] 11,75
D IRIDIS 2 (AT) 14.50
□ IRIDIS 2 (AT) ID) 16.95
EDU-WAHE
D ESP (AP) [Dl 14,50
D NETWORK (AP) [D] 17.95
Q PRISONER (AP) [D| 26,95
D SPACE (AP) [Dl 26,95
n SPACE II (AP) ID] 22,60
D TERRORIST (AP) [D] 26.95
PR06RAMMA
D EXPAND-A-PORT (AP) 53,95
a JOYSTICK (AP) 44,95
DTINYPASCAL (AP) |D| 44.60
D WPS STANDARD (AP) (D) 117.00
HAYDEN
n SARGON II (AP) 25.00
DSARGONII (AP) [D) 30.00
D REVERSAL (AP) 25.00
ARTSCI
n MAGIC WINDOW [D] (AP) 89.95
If you don't see it listed, write...we probably have it in stock!
Ship the above programs as checked to:
Mr./Mrs.
Address
City
Number of Programs Ordered.
State .
.Zip_
Amount of order
NY. residents add Sales Tax
Add shipping anywhere in the U.S. ?:25
Total amount enclosed
Charge my: D Master Charge D Visa
Name of Computer
Signature
with
MICRO-JULY '81
K memory Card No.
Personal Ctiecks please allow 3 weeks.
.Expires .
Mail to:
DI6IBYTE SYSTEMS CORP.
31 East 31st Street, New York, N.Y. 10016
Phone; (212). 889-6975
12
MICRO - Thie 6502/6809 Journal
/
/
./
No. 36 -July 198
r
Function Input Routine
for Applesoft
Applesoft permits the
Identification of a function
through the use of the DEF FN
command. This article describes
a self-modifying subroutine
which allows function input
during program execution.
2. In a string the characters SIN are
stored as 83, 73, 78 (decimal),
whereas in a function SIN is
represented by the decimal 233. A
similar state of affairs exists for
LOG, SQR, TAN, etc.
These cases are handled in lines
5080-5230. After translation, the
appropriate code is POKEd into the
function definition by line 5260. When
the entire string has been transferred,
line 5290 POKEs the code for ":" and
the code for "RETURN".
Roy E. Myers
William G. Miller III
The Pennsylvania State University
New Kensington, PA 15068
Software which accepts user-defined
functions frequently receives them by
giving the user the instructions such as
TYPE
10 DEF FN FPC) =
(YOUR FUNCTION)
(RETURN)
THEN TYPE
RUN 10
(RETURN)
This procedure is made necessary by the
fact that Applesoft makes no provision
for function input. How much simpler
for the novice user to be asked:
ENTER F(X) = _
The program below allows this
approach. The procedure receives the
function as a string, then "transfers"
the string to a line at the end of the pro-
gram (line 5330), which initially reads
5330 DEF FN FPQ =
The "transfer" must take into accoimt
the following:
1. In a string, the characters *, +, -,
/, = , A are represented by the ASCII
character codes 42, 43, 45, 47, 61, 94
(decimal). But, in a function the
arithmetic operators *, +, -, /, =,
A are represented by the decimal
I codes 202, 200, 201, 203, 204. (See
the Applesoft Reference Manual,
pages 121, 138, 139.)
10 IjOMEM:
PEEK (176) * 256 + PEEK (175) +
256
20 INPUT
'EMll'K F(X) = ";F$
30 GOSUB
5000
100
REM
200
REM
300
REM
PROGRAM
400
REM
BODY
500
REM
GOES
600
REM
HERE
700
REM
800
REM
4999
END
5000 FINI =
= PEEK (176) * 256 + PEEK (175) -
- 4
5010 FOLD =
= FINI
5020 l"= LBH (F$)
5030 STR =
PEEK (112) * 256 + PEEK (111)
5040
FOR Q = 1 TO L
5050 A = PEEK (STR + Q - 1)
5060 B = PEEK (STR + Q)
5070
C = PEEK (STR + Q + 1)
5080
IF A
= 42 THEN A = 202
5090
IF A
= 43 THEN A = 200
5100
IF A
= 45 THEN A = 201
5110
IF A
= 47 THEN A = 203
5120
IF A
= 61 1HEU A = 208
5130
IF A
= 94 THEN A = 204
5140
IF A
= 83 AND B = 71 ANE C = 78 THEM A
= 210:
Gaio
5250
5150
IF A
=73ANDB=78ANDC=84 THEN A
= 211:
GUiO
5250
5160
IF A
= 65 AND B = 66 AND C = 83 THEK A
= 212:
GCTO
5250
5170
IF A
= 83 AND B = 81 AND C = 82 THEN A
= 218:
GOTO
5250
5180
IF A
= 76 AND B = 79 AND C = 71 THEN A
= 220:
G01X3
5250
5190
IF A
= 69 AND B = 88 AND C = 80 THEN A
= 221:
GOTO
5250
5200
IF A
= 67 AND B = 79 AND C = 83 THEN A
= 222:
GOTO
5250
5210
IF A
= 83 AND B = 73 AND C = 78 THEN A
= 223:
Gaio
5250
5220
IF A
=84ANDB=65ANDC=78 THEN A
= 224:
uaiu
5250
5230
IF A
= 65ANDB = 84ANDC = 78 Tt-IEN A
= 225:
GOTO
5250
5240
oavo
5260
5250 Q = Q
+ 2
5260
PCKE
FINI, A
5270 FINI =
= FINI + 1
5280
NEXT
5290
POKE
FINI, 58: POKE FINI + 1,177
5300
PCKE
FINI + 2,0: POKE FINI + 3,0: POKE
FINI +
4,0:
POKE FINI + 5
10
5310
POKE
FOLD - 10, (FINI + 3) / 256
5320
PCKE
FOLD - 11, FINI + 3 - 256 * PEEK (FOLD -
10)
5330
CEF
m F(x) =
No. 38 -July 1981
MICRO - The 6502/6809 Journal
13
Ml
Before a user identifies a function,
line 5330 reads:
5330 DEF FN FQC) =
If a user defines the function to be 2*X*
SE^(XJ, the program changes line 5330
to read:
5330 DEF FN F(X) = 2*X*
SIN{X) : RETURN
The remainder of the program con-
sists of housekeeping chores. Set
LOMEM high enough to allow room to
input the function (line 10). Since an in-
put line is no more than 256 characters,
LOMEM could be set to end-of-program
+ 256.
The fimction is transferred from
string storage to the DEF FN F(X) =
statement. Line 5030 identifies the
beginning of string storage. The most
recently defined string will begin at this
location. The DEF FN F(X) = statement
is at the end of the program and it is
there that the program will POKE the
code for the function. Line 5000 iden-
tifies the end-of-program memory loca-
tion. It is necessary to subtract 4 from
the actual end-of-program, in order to
write over the end-of-program and end-
of-line code. Line 5300 replaces the
code.
In the memory locations preceding a
program line Applesoft inserts a pointer
to the beginning of the next line. Since
additional code is being POKEd at the
end of line 5140, the pointer preceding
the line is incorrect. Lines 5310, 5320
reset the pointer so that it points to the
end-of-program code.
The program segment 5000-5140
may be re-used several times within a
program to re-enter the function, since
the end-of-program pointer stored at
locations 175 and 176 are not changed
by the program.
Since the user of a program which in-
cludes this procedure may mis-type the
function (e.g. leave out a
for
multiply), the programmer may wish to
have an appropriate ONERR GOTO
statement before the first usage of the
function.
Roy E. Myers is Associate Professor of
Mathematics at The Pennsylvania State
University, New Kensington, PA. His
work with the Apple II is primarily
concerned with computer graphics as an
instructional tool in mathematics.
William G. Miller HI is currently a
programmer at Perm State, writing
accounting programs for classroom
instruction. He is also investigating the
possibilities of opening a computer
services business.
iMCftO
CBM/PET? SEE SKYLES ... CBM/PET
I **You mean this one little
Disk-O-Pro ROM will give my
PET twenty-five new commands?
And for just $75.00? Why, that's only $3.00 a command!"
The Disk-O-Pro in any PET with Version m (BASIC 2.0) ROMs (### COMMODORE
BASIC ###) will give 19 software compatible disk instructions*: 15 Identical with the new
BASIC 4.0 (or with 8032 ROMs) compatible with both old and new DOS. Plus 4 addi-
tional disk commands. . .including appending (MERGE), overlaying (MERGE # )
and PRINT USING, allowing formatting output of strings and numbers on the PET
screen or on any printer.
'NOTE: Old DOS doesn't recognize three of the commands.
Those are just 3 of the important commands— and there are 7 more beauties— on
your Disk-O-Pro that have never been available previously to PET/CBM users. (Skyles
does it again!) . . . Beauties like the softtouch key (SET) which allows you to define a key
to equal a sequence of up to 80 keystrokes; like SCROLL whereby all keys repeat as well
as slow scrolling and extra editing features; like BEEP which allows you to play music on
your PET.
The Disk-O-Pro is completely compatible with the BASIC programmer's Toolkit. The
chip resides in the socket at hexadecimal address $9000, the rightmost empty socket in
most PETS. And for the owners of "classic" (or old) PETS, we do have interface
boards.
(For those owning a BASIC 4.0 or 8032, even though the Disk-O-Pro may not be suit-
able, the Command-O is. Just write to Skyles for additional information. Remember, we
have never abandoned a PET owner.)
Complete with 84-page manual wMtten by Greg Yob. . .who was having so much fun
that he got carried away. We had expected 32 pages.
Skyles guarantees your satbfaction: if you are not absolutely happy with your new
Disk-O-Pro ROM chip, return it to us within ten days for an immediate full refund.
Disk-O-Pro from Skyles Electric Works $75.00
Complete with interface board (for "classic" PETS) 95.00
Shipping and Handling (USA/Canada) $2.50 (Europe/Asia) $10.00
i California residents must add 6%/6'/i % sales lax, as required.
Sky)eS Electric Works visa/Mastercard orders: call tollfree
231E South Whisman Road (800) 227-9998 (except California).
Mountain View, California 94041 California orders: please call (415)
(415) 965-1735 9«5-1735.
/lAiaO • • S31AMS 33S clBd/IAiaO"
CBM/PET? SEE SKYLES ... CBM/PET
** Should we call it Command-O
or Command-O-Pro?"
That's a problem because this popular ROM is
called the Comman(i-0-Pro in Europe. (Maybe
Command-O smacks too much of the military.)
But whatever you call it, this 4K byte ROM will provide your CBM BASIC 4.0 (4016,
4032) and 8032 computers with 20 additional commands including 10 Toolkit program
editing and debugging commands and 10 additional commands for screening, formatting
and disc file manipulating. (And our manual writer dug up 39 additional commands in the
course of doing a 78-page manual!)
The Command-O extends Commodore's 8032 advanced screen editing features to the ulti-
mate. You can now SCROLL up and down, insert or delete entire lines, delete the char-
acters to the left or right of the cursor, select TEXT or GRAPHICS modes or ring the
8032 bell. You can even redefine the window to adjust it by size and position on your
screen. And you can define any key to equal a sequence of up to 90 key strokes.
The Command-O chip resides in hexadecimal address $9000, the rightmost empty socket
in 4016 and 4032 or the rearmost in 8032. If there is a space confiict, we do have Socket-
2-ME available at a very special price.
Skyles guarantees your satisfaction: if you are not absolutely happy with your new
Command-O, return it to us within ten days for an immediate, full refund.
Command-O from Skyles Electric Works $75.00
Complete with Socket-2-Me 95.00
Shipping and Handling (USA/Canada) $2.50 (Europe/Asia) $10.00
California residents must add 6%/6'/2 % sales lax, as required.
(■)) Skyles Electric Works visa/Mastercard orders: call tollfree
W 231E South Whisman Road (800) 227-9998 (except California).
O Mountain View, California 94041 California orders; please call (415)
^^ (415)965-1735 %5-173S.
/lAiaO • ■ S3TAMS 33S 6l3d/IAiaO"-
14
MICRO - The 6502/6809 Journal
No. 38 -July
r
Vector Calculations
with a Microcomputer
Many physics and engineering
problems Involve the use of
vectors. Unfortunately the
required calculations are often
tedious and susceptible to
errors. This microcomputer
program, compatible with PET,
OSi, and Apple systems, speeds
the process, and avoids costly
errors.
Peter A-. Koski
144 Delaware Avenue
Apartment F
Troy, New York 12180
At an engineering school, a myriad of
problems are continually being solved.
Most are examples of real world situa-
tions. Whether they be differential equa-
tions expressing some complex rate of
change (world population growth, for
example), or the moment of an applied
force on a supporting member (engineer-
ing design), these are real problems. In
solving these, the computer can be used
as a very powerful tool. Programs used
for problem-solving don't need to be
masterpieces of structured program-
ming, they only need to speed arrival at
an answer.
In many cases, answers are only
good approximations — very good when
using the computer. For example, when
trying to find a root of a polynomial
equation, Newton's method is often
used. This method involves refining an
"educated" guess. Using a small pro-
gram, many iterations may be made in a
small fraction of the time it would take
to manually make one refinement.
Definite integral problems in
mathematics may be very well approx-
imated by giving dx a very small finite
dimension and summing along the
jgiyen interval. Without the machine,
this couldn't be done, as many hundreds
of calculations must be made.
No. 38 -July 1981
z
X
^
p
/
^
\
^
V
y^^
7
y^
\
^^2
y
4
Y
X
^
y^^
y
4
f\guiB 1: Showing F and r as their com-
ponents. (Note: not to scaie.)
1 13 y0
lose
1 1 ei0
1105
me
1115
1120
1130
1140
1150
1160
1165
1170
1180
1190
1191
1192
1193
1194
1195
1196
1197
1198
1200
1210
1220
FRIHT
PRim
PRINT
PRINT
PRINT
PRIHt
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
0ET2*
PRINT
PRINT
PRINT
PRINT
Vf- 1 \ijR r Hi Liji m liin."
PV PKUT-' Ml HH I MSI 1"
'VECTORS USED B'l' THIS PF-'OGPIlM RRF "
'REFERRED TO B'r' I.ISEP -CiFF lUFD"
'HHMES. PROVISION HFiS BfcEH MHDE"
'FOR 15 UNIQUE '•/EL. TOPS. "
'VECTORS MUST BE DEFINED TO THE"
"PROORFIM PRIOR TO AN't' CHLCULFITIONS"
•INVOLVING THEM. DEFINED VECTORS"
"MFIV be redefined IMPLICITLV OR"
'EXPLICITLV."
■KEV WORDS/SYMBOLS FIRE RESER''/EO"
"FOR PROGRRM USE FIND THEREFORE"
"MfiV NOT flPPERR EtIBEDDEO OR RLONE"
"IN Fl VECTOR LRBELlLIST, DELETE,"
" X, .CPERIOD), /,. +, -, =. "
SPRINT "PRESS FINV KEV TO CONTINUE"
|IFZ»=""THEH1197
"3"; I REM CLEAR SCREEN
"OPERFITIONS SUPPORTED / FORMHT i"
"•VECTOR DEFINITION — LHBEL=a/J/K"
MICRO - The 6502/6809 Journal
15
In all branches of science and
engineering, vectors aie often used in
problem solving. A vector is a three-
dimensional line of force, having both
magnitude and direction. By defining
forces, velocities, displacements, etc.,
as vectors, certain relationships may be
easily developed and solved. Vectors are
most often expressed in terms of their x,
y, and z components.
Often, developing the vectors and
vector equations can be time consuming
enough without having to grind through
the arithmetic to the final solution.
That is the purpose of the program
presented here.
VECTOR is a conmiand-line pro-
cessor which allows the user to define
and operate on vectors. Program com-
mands allow the user to DEFINE (enter
vector and its label), DELETE (remove a
vector from the work file), LIST (print a
list of all vectors in work file), or CLEAR
all vector definitions from the work file.
Operations available are addition,
subtraction, dot products and cross pro-
ducts. Operations producing a resultant
vector add the new vector's definition to
the working file. If a previously-defined
vector is specified as the resultant label,
the vector will be re-defined and its
previous value is lost, but the program
will inform you of the redefinition.
Looking at an example, consider
finding the moment (torque) of a force
acting on a point. From mechanics, the
moment, M, about point, P, is equal to
vie vector locating the force, crossed
with the vector defining the force:
M=txf. Referring to figure 1, r may be
expressed as (3,4,7) and F as (2,4,-1).
The solution is arrived at, long-hand, by
establishing a matrix and solving it.
Alternately, the VECTOR program may
be employed as follows (see sample run):
(define vector rl
1. R = 3, 4, 7
2. F = 2,4,-1 (define vector F)
3. M = RXF (M is defined as r
cross F)
As is seen, the output produced is the
desired moment vector as well as the
angle between the two original vectors.
Many time-consuming mistakes are
eliminated by avoiding the long-hand
arithmetic solutions.
Peter Koski is a sophomore at Rensselaer
Polytechnic Institute majoring in
Biomedical engineering and minoriag in
Computer Systems engineering. Most of
his work is on an OSI Challenger 2-4P
mini floppy system. Pete enjoys
ilntegrating hardware and software in
optimizing his system.
iMCftO
1230 PRINT
1240 PR I NT "#L I ST DEFINED VECTORS — LIST"
1250 PRINT
1254 PRINT"#DELETE VECTOR — DELETE LABEL"
1256 PRINT
1258 PRINT"*CLEI=IR ALL VECTORS — CLEAR"
1259 PRINT
1260 PRINT"*DOT PRODUCT — LABEL 1 .LABELS"
1270 PRINT
1280 PRINT"*CROSS PRODUCT — RESULT»LHBEL1XLABEL2"
1290 PRINT
1293 PRINT" *HDDIT ION — RESULT=LABELl+LAeEL2"
1294 PRINT
1300 PRINT"#SUBTRACTION — RESULT=LABEL1-LABEL2"
1310 PRINT
1315 PRINT"NO EMBEDDED BLANKS ARE PERMITTED IN"
1320 PRINT"COMMAND LINES <EXCEPT FOR DELETED"
1322 PRINT
1324 PRINT"LABEL, LABELl, LABEL2, RESULT"
1326 PR I NT "REFER TO USER-DEFINED VECTOR NAMES. "
1330 REM
1340 DIM LBL*<15>,I<15.>.,J'<:i5>,K<15>
1350 LBL=0
1360 DEF FNT<}<:> = INT<:i00#;O,^100
1370 DEF FNC<X>=ATH<S«R<1-Xt2?/X)
1375 DEF FNS<X)=ATN<><:/SQR<1-Xt2>>
1380 DEF FND<X>=57.2957795*X
1400 REM
1410 REM PROCESS COMMAND LINE
1420 REM
1440 PRINT: INPUT LN«
1450 IF LN*="" THEN PRINT"3" sCLR :END
1460 REM
1470 REM CHECK FOR LIST / CLEAR / DELETE COMMANDS
1480 REM
1490 IF LN«="LIST" THEN 5000
1500 IF LN*=" CLEAR" THEN CLR : OOTO 1336
1510 IF LEFT»<:LN»,6.-> = "DELETE"THENT1S=RIGHT«';LN«.,LEH<LN*:)-7> 1
GOTO6000
1520 REM
1530 REM SCAN FOR IMPLICIT OR EXPLICIT DEF IN I TON
1540 REM OF VECTOR
1550 REM
1560 F0RI=1 TO LEN<;LN*>
1570 T»=MID*<LN*,I,1)
1580 IF T«="/" THEN 1600
1585 NEXT I s GOTO 1700
1590 REM
1600 REM EXPLICIT DECLARATION OF VECTOR / DOT PRODUCT
1610 REM
1620 Tl«=""
1630 FOR 1=1 TO LEN<LN*>
1640 T*=MID*<LN»,I,1>
1650 IF <:T*=" = ">0R<:T*=". ">THEN OP«=T* : OOTO 1670
1655 T1*=T1*+T«
1660 NEXT I
1665 GOTO 9030
1670 t2*=riqht*<:ln«..len<ln*:>-i ■>
1680 GOTO 1900
1700 REM
1710 REM IMPLICIT DECLARATION OF VECTOR
1720 REM
1730 RVL*=""
1740 F0RI=1 TO LEN<LN»>
1750 T*=MID*<LH«,I,1>
1760 IF CT*="=")THEN 1810
1770 RVL*=RVL*+T»
1780 NEXT I
1790 GOTO 9030
1800 REM
1810 REM ASSIMILATE Tl«
1820 REM
1830 Tl»=""
1840 FOR J=<I+1> TO LEN<LN*>
1845 T*=MID*<LN*,J,1>
(Continued)
'A
ie
MICRO - The 6502/6809 Journal
No. 38 -July 19
18513
1855
1860
1865
1895
1900
1910
1920
1930
1940
1950
1960
1970
2000
2010
2020
2030
2035
2040
2045
2050
2052
2055
2057
2060
2100
2110
2120
2130
2140
2150
2155
2160
2170
2130
2190
2200
2210
2220
2230
2240
2250
2260
3000
3010
3020
3030
3040
3050
3055
3060
3070
3080
3090
3100
3110
3130
3140
3150
3160
3170
3160
3190
3192
3200
4000
4010
4020
4030
4040
4050
4055
4060
4070
, "ORT«="X"> THEN OP«=T*iGOTO 1395
IF <T»-"+"ORT*="-"ORT«=
T1«=T1*+T«
NEXT J
PRINT"* ERROR IH COMMRHD LINE *" ! GOTO 1440
T2*=R I GHT* ■; LH* ., LEN < LN* > -J :>
REM
REM JUMP TO ROUTINE FOR REQUIRED OPERATION
REM
IF 0P»="=" THEN 2000
0P*=". " THEN 3000
OP*="X" THEN 4000
0P*="+" THEN 7000
0P*="-" THEN 8000
IF
IF
IF
IF
REM
REM
REM
FOR 1=1 TO
IF LBL*<I>
STORE LHBEL AND CORRESPONDING I/J/K VALUES
LBL
:>Ti9
;T1*;"
THEN 2050
RE-DEFINED
GOTO 2210
-K>y
PRINT"* "
GOTO 2100
NEXT I
IF LBL<15 THEN 2060
GOTO 9040
GOTO 1440
LBL=LBL+1 ; I=LBL
T*="" : X*="": V»=""
FOR J=l TO LEH<T2*:>
T*=MID*<T2*,J,1>
IF T*=",''" THEN X=VRL';X*> : GOTO 2160
X*=X*+T*
NEXT J
PR I NT J
FOR K=';j+1> TO LEN(.T2*:j
t«=mid*';t2*.k.. i:>
IF T»="/" then V=VflL<V»:
Y*=V»+T*
NEXT K
2=VAL BRIGHT* (T2*, LEN (.T2*:'-
REM
REM DEFINE VECTOR
REM
LBL»<I>=T1*: I<I>=Xi J<i;'=V: K<:i>=Z
GOTO 1440
REM
REM DOT PRODUCT CALCULATION
REM
FOR 1=1 TO LBL
IF LBL*';n=Tl» THEN 3060
NEXT I
T0*=T1* ;OOTO9060
U 1 = I C I :> : U2= J C I > : U3=K CI!)
FOR J=l TO LBL
IF lbl«<:j:)-T2« then 3110
NEXT J
T0*=>T2»iGOTO9060
vi = i<j:)i v2=j<:j>i V3=k<j>
UV= <; U 1 ♦V 1 +U2*V2+U3#V3 >
U»SQRc:Ult2+U2t2+U3t2>
V=SQR < V 1 1 2+V2t2+V3t2 >
PRINT
PRINT Tl*;' DOT ".»T2»;" = "^FNT<UV>
PRINT"COS<rHETfi> - ■•;FNT<UV/<U*V> >
PRINT"THETH - ";FHT<FNC<UVV<:U*V>>>;
PRINT" < " ;FNT<FND<FNC<UV/<U#V) > > > ; "
GOTO 1440
REM
REM CROSS PRODUCT CALCULATION
REM
FOR 1=1 TO LBL
IF LBL»<I>»T1» THEN 4060
NEXT I
T0»=Tl*iOOTO9060
U1-I<I>| U2=J<I>I U3»K<I>
FOR J-1 TO LBL
DEGREES )"
(Continued)
9|c:|e4e4c4c*4c9|e
3)
CD
■a
c
4^
00
■D
5"
o
<D
5"
0)
o
o
TJ
01
O
CO I 1>
0) » 0,
CO (B •<
ff Q- s"
O
<e
a
3"
(6
0)
=: a
+ «
0)
Co (Q
a «
O
3
o
c
a
a
o
o
3
■o
<B"
Q.
o
o
Q.
CD
X <D
I s
c» -^
o. 1>
? 2
a- 2:
y 5 ^
S. " -«
~. 2. o
a c "^
a- a-. S-
m o M
^ a -»
3 o
8 «
o
33
c
a
o>
M
5"
o
M
I
<b
0)
s-
^ m
"n
.-<o
m
<
m
a-
a
Cr
O CD
a s)
Q. 0)
Ik o
■O
■Q
S"
CO
o
C' ^, io
o • w eo
o <n
o
8i.S
a o <
CD g o
CO o
^ 2 »
13
Q- rn
O 5
z s
3 o^
9 "• 2 3
O ;5 O =
o < 3
•5 » — =
£ ® » »
- « X
3-3 g.
5 « g"
3 ;r 3
o 1^
>^
m
m
0) "
o
a
(D
CO
CO
CD ^
— O)
/•^ —
CO o
o
-» o
m
2. o
3 o "n
CO 3 O
^ = 5
? c
m r*
No, 38 -July 1981
MICRO - The 6502/6809 Journal
17
(Continued fzom page 6)
were a first. Then they were pleased,
very pleased. They thanked me pro-
fusely and said they'd do something
about the thief immediately. Good!
One pirate down (perhaps) and him-
dreds, at least, to go.
How many people, however, are
afflicted with an ethical standard that
makes them pay $125 (the lowest,
legitimate discoimt price I've seen for
VisiCalc) when they could get the pro-
gram for $40? How many moral deci-
sions can be bought for $85 plus tax? As
long as a conscience can be bought for
that or less, there will be software
thieves popping up like spiders in spring.
I offer a proposal, then, to cut the
feet from under the pirates. I challenge
software manufacturers to stop the
thieves as they start, before "protec-
tion' ' is forced upon us all. They can do
it. I can't. Let each software manufac-
turer reward the first person reportii;g a
software thief with a free, le^timate
copy of the program being stolen or
another of equivalent value. Then let
the manufacturer's lawyer obtain a
court injunction, at the least, against
the thief's sales. A software buyer
would then have a real incentive to
keep the business honest. A software
manufacturer would make a profit if he
could prevent the thief from selling but
one or two pirated copies. A software
magazine would be able to devote its
editorial page to technical rather than
legal problems. A software thief would
have to find a way to turn an honest
buck and sleep better for it. Above all,
each and every one of us would keep
OUT taxes from going up still more and
would retain a free-market economy in
computer software,- that, my friends,
would keep all our costs down.
Let us not forget the user while
we're protecting the manufacturer.
Yes, we do need better service and sup-
port. Yes, we do need backup copies for
our personal use. Yes, we do need the
information to customize our pro-
grams. Yes, we do need lower cost soft-
ware. But software piracy will cost us
all more in the long run, both in dollars
and in freedoms. We can stop it here.
And now.
I have asked this magazine not to
print my name or location. This is not
because I don't sign up to what I say.
Instead, I fear reprisals from thieves. If
you feel that you must deal with a soft-
ware thief, remember this advice of-
fered me by a police detective. All
thieves, when thwarted, readily turn to
murder.
Anonymous
(Continued on next page)
4080 IF LBL*':J>»T.2« then 4110
4090 NEXT J
4100 PRINT"# "JT2*;" NOT IN WORKING FILE *" lOOTO 1440
4110 Vl-I<J>i V2-J<J>| V3-K<J>
4130 FOR I-l TO LBL
4140 IF LBL»<I><>RVL» THEN 4160
4145 OOSUB9070
4150 OOTO4250
4160 NEXT I
4170 IF LBL<15 THEN 4240
4180 GOTO 9040
4190 OOTO 1440
4240 LBL-LBL+ll I-LBLs LBL*<I .^-RVL*
4250 I<I>=<U2«V3)-<V2#U3>
4260 J<I>-i:Vl*U3>-<Ul*V3)
4270 K<I>-<U1*V2>-<V1*1I2>
4280 UV-SQR< I < I >t2+J< I >t2+K< I >t2>
4290 U»SQR<Ult2+U2T2+U3t2>
4300 V-SQR < V 1 t2+V2t2+V3t2 >
4310 PRINT
4320 PRINTTl*^" CROSS ";T2»;" - <";I<I) ;"I ," ;J<I>;" J, '
;K<I>;"K >
4330 PRINT-SIN <THETH> - '•;FNT<UV/<U*V>>
4340 PRINT-THETH = "^FNT<FNS<UV/CU*V>>>;"<"^
4350 PRINTFNT<FND<FNS<UV^<U*V>>)>;" DEGREES )"
4360 OOTO 1440
5000 REM
5010 REM LIST VECTORS PRESEHTLV ON FILE
5020 REM
5030 PRINT
5040 PRINT"LHBEL";TflB<8>|"I";THBC14>;"J";TRB<20>l
5045 PRINT"K";TftB<24>^"MflONITUDE"
5050 PRINT"-"— ";TfiB<8>;"-" ^THB"; 14);"-" |THB<20>;
5055 PRINT"-" >TnB<24> / "=-=——=-"
5060 PRINT
5070 FOR I-l TO LBL
5075 MRO-SQRC I < I )t2+J< I >t2+K< I >t2)
5080 PRINTLBL*< I > ;TfiB<8) ;FNT< I < I > ) 7TflB< 14) ;FNT< J<: l>>f
5085 PRINTTflB<20);FNT<K<I.'>)|TflB<24)/FNT<MfiG>
5090 PRINT
5100 NEXT I
5120 OOTO 1440
6000 REM
6010 REM DELETE LABEL Tl* FROM WORKING FILE
6020 REM
6030 FOR 1=1 TO LBL
6040 IF LBL«<I)=T1« THEN 6160
6050 NEXT I
6060 T0*-T1«3GOTO 9060
6070 OOTO 1440
6100 FOR J- I TO <L8L-1)
6110 LBL*<J)»LBL»<J+1)
6120 I<J>-I<J+1>| J<;j>=J<J+l>! K<J)=K<J+1>
6130 NEXT J
6140 LBL-LBL-1
6150 GOTO 1440
7000 REM
7010 REM VECTOR ADDITION
7020 REM
7100 FOR J=l TO LBL
7110 IF LBL*';J)=T1» THEN 7130
7120 NEXT J
7125 T0*-T1*:GOTO 9060
7130 U1-I<J)J U2-J<J>i U3=K<J)
7140 FOR K=l TO LBL
7150 IF LBL«<K)=T2« THEN 7180
7160 NEXT K
7170 T0*-T2*:GOTO 9060
7180 Vl=I<K)i V2=J<K>: VS-KCK)
7200 FOR 1=1 TO LBL
7210 IF LBL*<I)ORVL* THEN 7246
7220 GOSUB9070
7230 GOTO 7300
7240 NEXT I
7250 IF LBL<15 THEN 7295
(Continue
18
MICRO - The 6502/6809 Journal
No. 38 -July IS
<" ; I a .:■ .; " I , " ; J'; I > ; " J, " ;K<: I > .s "K >"
7260 GOTO 9040
7270 GOTO 1440
7295 LBL=LBL + 1 : I=LBL: LBL*'; I :'=RVL*
7300 I';i>'=Ul+Vl
7310 J<.'I)=U2+V2
7320 K<I>=U3+V3
7330 PRINT
7340 PRINT Tl*;" + ",-T2*;'
7350 GOTO 1440
8000 REM
8010 REM VECTOR SUBTRACTION
8020 REM
8030 FOR J=l TO LBL
8040 IF LBL*<:J5=T1» THEN 8080
3050 NEXT J
8060 T0»=T1»:GOTO 9060
8080 LI 1 = I (,■ J :, : U2= J < J .) ! U3=K (. 3 ':>
8090 FOR K=l TO LBL
8100 IF lbl*'.:k:)=t2* then 8130
8110 NEXT K
8120 T0*=T2«!GOTO 9068
8130 V1 = I'::K./: V2=.J';k:) : v3=k<k:>
3150 F0RI=1 TO LBL
3160 IF LBL*<:i:)<>RVL* THEN 3190
8170 GOSUB 9070
8180 GOTO 8250
8190 NEXT I
3200 IF LBL<15 THEN 8240
8210 GOTO 9040
3220 GOTO 1440
8240 LBL=LBL + 1 ! I=LBL! LBL4< I :)=RVL»
8250 i<:i>=ui-vi
8260 J<I>=U2-V2
8270 K<:i.')=U3-V3
8280 PRINT
8290 PR I NTT 1*;" - ".!T2*!
8300 GOTO 1440
9000 REM
9010 REM MESSRGES
9020 REM
9030 PRINT"* ERROR IN COMMFIND LINE *" :GOTO 1440
9040 PRINT"* DEFINITION SPACE EXCEEDED *"
9050 PRINT"* DELETION REQUIRED *" iGOTO 1440
9060 PRINT"* ";T0*.:" NOT IN WORKING FILE #" sGOTO 1440
9070 PRINT"* ";RVL*.!" REDEFINED *" rRETURN
= <:" ; I < I > .; " I ., " .! JC I > ,■ " J, " .sK< l>} "K
(Letterbox continued)
Dear Editor:
I would like to relate a problem I
encountered servicing an early KIM-1
computer. The 6502 uP had died for
reasons imknown. The uP, when it was
working, was of early enough vintage
so that it did not have the rotate right
ROR instruction. When a replacement
uP was put in, the system still did not
work. (The original had to be un-
soldered and was replaced with a new
one in a socket.) The problem was the
crystal oscillator circuit. The original
consisted of only a crystal across 6502
pins 3 and 37. When the uP was replaced,
apparently the uP intemal clock cir-
cuitry did not have enough gain in the
updated process to sustain oscillation. I
was able to modify the oscillator circuit
by removing one side of the crystal
from the circuit board, and adding 4
parts and wiring so that the circuit
matched later-production KIM-l's. No
circuit board cuts had to be made and
the uP oscillator now works. Figure 1
shows the modification.
I wotild like to hear other readers'
experiences servicing 6502-based uP
systems. We could all learn about
unusual problems which may be com-
mon to many different systems.
Eric R. Bean
927 S. 26 St.
South Bend, Indiana 46615
r
OS I CIR- mOD I F^ I CFHT I OMS
1197 POKE 57088,0: IF PEEK C 57088 .^=255 THEN
1197
9130 FOR 1=1 TO 24: PRINT: NEXT I
OS I CS: — ■=*l=" MOD I F=- I OFHT I OMS
1000 GOSUB 9130
1197 POKE 57088,255: IF PEEK'.:57088> = 1 THEN
1197
1198 GOSUB 9130
1450 IF LN*="" THEN GOSUB 9130: CLERR : END
9100 REM CLEAR SCREEN —
9110 REM VOU MRV WISH TO USE YOUR
9120 REM OWN MACHINE LFlNi3UflOE ROUTINE
9130 FOR 1=1 TO 32: PRINT: NEXT I
9140 RETURN
i=iF>F*l_E: MODIR- lOF^T lOM
1000 CRLL -936: REM CLEAR SCREEN
1198 CALL -936: REM CLEAR SCREEN
No. 38 -July 1981
MICRO - The 6502/6809 Journal
Write to MICRO
Do you have any comments, gripes
or suggestions that might be
valuable for other readers? Send
your letters to Letterbox, MICRO,
P.O. Box 6502, Cheknsford, MA
01824. If you've found bugs in any
of our programs, or have discovered
a better technique, write to
Microbes and Updates, at the same
address. We need to hear from you!
19
V« «s«(K awt* «M|« oMttt cw4»
fiiQil order
lommttf Coffvut*** '^' Vj
OPEK EVEKY DAY 9 to 6 PST
ColiforniQ, Alaska & Foreign orders (714) 69d-MftA
Shipping Informotion or Dockorders coll (714) 6964260
Service Center ond for Technical Information (714) 4604902
ORDER TOLL FREE
600-654-6654
,i.J^
ippkzGomputGr
Authorized Dealer
ALL EQUIPMENT IS
FCC APPROVED,
^\
APPLE II PLUS 16K 1049
APPLE II PLUS 48K
(APPLE Memory) 11 89
APPLE II Standord Models. . . CALL
DISK II DWVE G CONTROLLER. 529
This model includes DOS 3.3 16 seaor
Tor nvE scuiM
Language System W/Poscol 425
Silentype Printer W/lnterface 549
Hayes Micromodem II 319
Videx Videoterm 80 w/grophlcs 335
Z-aO Microsoft Cord 299
AWJ coMrann mc.
Dish II Drive Only 445
Integer or Applesoft II Firmwore Cord ... 155
Graphics Tablet 649
Porollel Printer Interfoce Cord 1 55
Hi-Speed Serial Interface Cord 1 55
Smorterm 80 Column Video Cord 335
MOUHTAM COMranR wc
Music System (16 Voices) 479
A/D + D/A Interface 31'
Exponsion Chossis 555
lntrol/X-10 System 249
Cloch/Colendor Cord 239
Supertolker SD-200 249
Romplus+ Cord 1 35
Romwriter Cord 1 55
CALVOMU COMMITER SYSTEMS
ClocWColendor Module 109
GPIO IEEE-48B Cord 259
Asynchronous Serial Interface Cord 1 29
Centronics Porollel Interface Cord 99
We corry oil CCS hordwore. Pleose coll
MISC. Am.E HAROWAM
16K r^om Cord Microsoft 189
ABT Numberrc KeypodCold or new kybrd) .115
ALF 3 Voice Music Cord 229
Alpha Syntouri Keyboard System 1399
Coivus 10MB Hard Disk CALL
Lozer Lower Cose Plus 50
Micro-Sci Disk Drives CALL
SSM AlO Seflal/Porollel Cord A6T 189
Sup-R-Terminol 80 Col. Cord 339
5VA 8 inch Floppy Disk Controller 345
Versowriter Digitizer Pod 229
WE HAVE MART MOM ACCISOMES
FOR THE Am.E I M STOCK—
KEASE CAU OR WRITE FOR A FRICE LIST.
A
ATARI'
MODEL
aOO 16K
$799
n fAwai»''''
Atori 400 16K 499
810 Disk Drive 499
41 Program Recorder 69
850 Interface Module 175
822 Thermol Printer C40 col) 369
825 Printer (80 col) 795
Atari 1 6K Rom Module 155
Atari Light Pen 65
W* iteck aH Atari occMMriM 6
teftwor*. pleoM call loc mof* Info.
PRINTERS
Anodex DP-9500 W/2k Duffer 1375
Anodex DP-9501 W/2K Buffer 1 450
C. Itoh Stonwriter 25 CPS 1750
C. Itoh Stonwrtter 45 CPS 2450
Centronics 737 825
Epson MX-70 W/Grophics 449
Epson MX-80 132 Col 620
Paper Tiger IDS-445 W/Dot Plot 749
Poper Tiger IDS-460 W/Dot Plot 1 195
Paper Tiger 105-560 W/Oot Plot 1495
Qume Sprint 5/45 Doisywheel 2550
Silentype w/lnterfoce for Apple II 549
Wotonobe Digiplot 1 295
VIDEO MONITORS
Amdex/Leedex Video-100 12" D6W. .139
Hitachi 13" Color 389
NEC 1 2" P31 Green Phospher CALL
Ponocolor 10" Color 375
Sanyo 9" D6W 179
Sanyo 12"D&W 255
Sonyo 1 2" P31 Green Phospher 295
Sonyo 1 3" Color 445
Challenger 4P 699
C4PMF (Mini Floppy System) . 1 599
CIP Model II 449
Sorgon II (Disk or Cassette). ... 35
Fig Forth (Disk Only) 69
APPLE SOFTWARE
DOS Toolkit 65
Appleplot 60
Tax Planner 99
Apple Writer 65
Apple Post 45
D.J. Portfolio Evoluotor , . . ,45
D.J. News 6 Quotes Reporter 85
Apple Fortran 1 65
Apple Pilot 129
DOS 3.3 Upgrade 49
Music Theory 45
The Controller Ous. Sys 519
MISC. APPUCATIOHS PACKAGES
Visicolc 125
Desktop Plon II ,169
CCA DoCQ Monogemem DM5 S5
Eosywriter Word Processor 225
ASCII Express 65
Super Text f( 139
Progrommo Apple Pie . 119
The Landlord Apt. Mgmt. Pkg 649
Peachtree Business Software , . . CALL
Tox Preparer by HowardSoft .69
Applebug Assenn/Disassm/Editor 75
3-D Grophics Dy Dill Oudge 53
6AMES
Flight Simulator 34
The Wizord and The Princess 32
Cosmos Mission (Space Invaders) 24
Sorgon II Chess , 32
Hi-Res Footboll 39
Adventure by Microsoft 27
Phantoms Five 39
Reversal (Othello) 34
KEASE CALL OR WRITE
FOR A COMPLETE
SOFTWARE LIST.
20
ORDERING INFORMATION, Phone Orders invited using VISA. MASTERCARD. AMERICAN EXPRESS. DINERS CLUO. CARTE OLANCHE, or boni< wire tronsfer. Credit
cords subject to service charge,. 2% for VISA & MC. 5% for AE. DC 6 CO. Moil Orders moy send credit cord account number (inclijde expiration date).
coshiers or certified check, money order, or personol check Callow 10 doys to cleor). Please include o telephone number with all orders. Foreign orders (excluding
Militory PO's) odd 10% for shipping oil funds must be in U.S. dollars. Shipping, handling and insurance in U.S. odd 3% (minimum S4.00). Calitornio
residents odd 6% soles tax. We accept CODs under $500. OEM's. Institutions & Corporotions please send for written quotation. All equipment is subject to
price change and avoilability without notice. All equipment is new ond complete with manufocturer worronty (usuolly 90 doys). We connot guorontee
merchontihility of any prtxfucts. We ship most orders within 2 doys.
D ty v^EAKE A MEMDEK OF THE DEnERDUSIKESSDUREAUAHO THE CHAMDEK OF COMMERCE
SHOVKOOM PRICES MAY DIFFER FROM MAIL ORDEK PRICES.
PLEASE SEND ORDERS TO:
COMSUMER COMPUTERS MAIL ORDER aaU PARKWAY DRIVE. 6ROSSMOMT SHOPPIHS CENTER KORTH LA MESA CALIF. 92041
MICRO - The 6502/6809 Journal
No. 38 - July
Phone Search
This program cross-links a
customer's phone number with
the actual record number of the
customer file so that his phone
number in effect becomes his
computer account number.
Horst K. Schneider
5341 West Bayaud Ave.
Denver, Colorado 80226
Is this the age of niunbers? It appears to
be. Wherever I go I seem to need a social
security number, an accovmt number, a
customer number, a subscriber number,
ad nausetun.
Our modem data processing equip-
ment has had a great deal to do with this
trend. But is it really necessary
to dehumanize relationships between
humans by insisting that Bill is #68542
and Judy is #68671?
I am a businessman who "went
computer" in 1979 with an Apple II
with 48K, a printer and two 5" disk
drives. While writing my programs for
invoicing, statements, and so forth, I
soon came to grips with the problem of
assigning each customer a number.
While I recognized the necessity of
doing this I still could not suppress my
feelings of aversion.
I decided to use a number my
customers were almost as familiar with
as their names — their telephone
numbers. Asking customers for their
phone numbers did not carry any stigma
— in fact, I hoped it created in their
minds the picture of an efficient office.
Mail orders posed no problem either;
very few business letterheads lack the
phone number.
Now we all know that a customer
file on a diskette stores the information
in records numbered sequentially. That
meant I needed a program to match a
phone number with the actual customer
number — or rather the record nvunber
of the customer file. So much for the
reason this program came to be.
Applesoft BASIC is a fine tool for
programming in general and I use it ex-
tensively, but there are cases when any
BASIC is just too slow for the business
environment. And you don't have to be
a mathematical genius to realize that a
program for this problem, written en-
tirely in BASIC, would be agonizingly
slow while the machine language rou-
tine would search through a list of 500
phone numbers in less than a second.
But read on — all you need is BASIC.
The assembly language listing is for
those who enjoy assembly programming
or for those who wish to get into it.
Writing the search and compare rou-
tine in machine language saves con-
siderable memory space since we can
nicely dispense with all the extra bytes
that Applesoft tacks on when storing
such a list of nvmibers as variables or
strings.
There are actually three parts to this
program. The main part, written in
Applesoft BASIC allows you to add to
the list, change the list, and search the
list. Then there is a short machine
language routine which the program in-
vokes with CALL 38332. It then does
the actual work of looking for the phone
niunber in a list of numbers. Finally,
there is a binary file containing all the
phone numbers.
Enter the program exactly as shown,
then type RUN 980. The last part of the
program you typed in creates your
machine language routine and saves it to
your disks in Drive 1 and Drive 2. (You
had a disk in each drive, didn't you?)
100
110
120
130
140
36825
FHCME SEARCH
BY HORST K. SCHNEIDER
warn SEARCH
HIMEM:
REM
REM
REM
REM
220 D$ - CHR$ (4)
230 PRINT D$"BLOftD PH-95"
1EXT : HCME : VTAB 3: HTNB 8: VKEST
VTAB 81 HTAB 10: PRINT "1 - SEARCH LIST"
VTAB 10: BTAB 10: PRINT "2 - ADD TO LIST"
VTAB 12: HTAB 10: PRINT "3 - CHANGE LIST"
VTAB 14: (fTAB 10: PRINT "4 - SAVE AIL CHANGES"
VTAB 16: HTAB 10: PRINT "5 - REOTBN TO MAIN"
VTAB 20: PRUTT "YOUR CHOICE,' PI£ASE7 -": VTAB 20: HTAB 24: GET Q$t PRIOT
:A - VRL (Q$): IF A < 1 OR A > 5 THEN GOSUB 740: GOTO 300
VTAB 23: PRINT "(- RESPCWD WITH 'X' TO REOTRN TO START)": POKE 35,22
240
250
260
270
280
290
300
310
320 ON A GCTO 330,420,530,830,800
330 HCME : VTAB 5: HTAB 4: PRINT "* * SEAKH PHCNE LIST * *"
340 Y - 1: VTAB 10: INPUT " - PHCWE ND.: ";A$: IF A$ - "X" THEN 240
350 GOSUB 700: GOSUB 690: IF NOT Y THEN GC6UB 740: GOTO 340
360 PCKE 38331,A: POKE 38330,B: POCE 38329, C: CfU. 38332
370 Y - 1: GOSUB 770: IF NCT Y THEN 400
380 A » PEEK (6) + PEEK (7) * 256
390 VTAB 14: PRINT "CUSTOMER NO.: ".-A / 3: GOTO 400
400 VTAB 19: PRINT " - ANCTIHER SEARCH? - Y/N ": VTAB 19; HTAB 28: GET Q$
■ IF 0$ » "Y" THEN 330
410 GOTO 240
420 HME : VTAB 3: HTAB 8: PRINT "* * ADD PHCNE NO. * *"
430 F - PEEK (38327) + PEEK (38328) * 256: GOSUB 730
440 Y - 1: VTAB 12: INPUT " - NEW PHCNE NO.: ";A$: IF A$ - "X" THEN 240
450 GOSUB 700: IF NCT Y THIN GOSUB 740: GCTO 440
460 IF F < 36827 THEN GOSUB 750: GOTO 760
No. 38 -July 1981
MICRO - The 6502/6809 Journal
21
Now you save your program on disk and
it's ready to go to work for you.
I have purposely not compressed the
code to make it easy to change or
relocate. It is also easy to increase the
list size by multiplying by three the
number of additional phone nvunbers
you wish to store and subtracting this
number from 36825 in line 100, from
36827 in line 460 and from 36826 in line
870, and adding it to 1574 in line 870.
If you operate with only one disk
drive (and in a business application that
is courting disaster) you should delete
the references to "]$" at the end of the
main program.
When entering a phone number you
may or may not use a hyphen (eidier
256-5515 or 2565515 is acceptable).
The program will tell you how many
phone numbers you have stored and will
also alert you to a 'LIST-FULL' condi-
tion. In my business we delete a
customer by changing his phone
number to 0000000. When adding a
customer we always first search for a
zero string and use that spot for our new
entry.
As shown, it is a stand-alone pro-
gram but can easily be incorporated into
a larger one by using a hook after line
900, setting HIMEM: at the beginning of
the main program, and deleting line 100.
The program is only a part of a larger
program that handles pricing, billing, in-
ventory control and statements, making
the customer number available directly
to the appropriate routines.
One last comment: All REM line
numbers end with a '5' (except starting
lines) for easier identification, even at
'List' speeds, in case you want to
remove them from your WORKING
program.
Horst K. Schneider is a businessman (both
wholesale and retail) who enjoys the
challenge that programming provides. His
first programming effort was fairly
ambitious. That program did all his
pricing, invoicing, inventory control and
monthly statements as well as other tasks
such as printing mailing labels. He
recently sold his business and has retired
into writing software.
470 GOSOB 690: PCKE F,A: PCKE F - 1,B: PCKE F - 2,C: POKE F - 3,255
480 F = F - 3iH = INT (F / 256) :L = F - H * 256
490 POKE 38327, L: POCE 38328, H: GOSUB 730
500 VTAB 16: PRINT " - OISTCMER NO.: "; (38326 - F) / 3
510 VTAB 19: PRINT " - ANOTHER ENTRy? - Y/N": VTAB 19: HTAB 26: GET Q$: PF
: IF 0$ = "Y" THEN 420 L': .
520 GCnO 240
530 HCME : VTAB 3: HTAB 6; PRINT "* * CHANGE PHCNE NO. * *"
540 VTAB 12: PRINT " - CUSTCMER NO. : ": VTAB 13: PRINT "(OR OLD PH. NO.
)": VTAB 12: HIAB 20: INPUT "";A$: IF A$ = "X" THEM 240
550 IF UN (A$) < 5 THEN N = 3 * VAL (A$): GOTO 600
560 y = 1: GOSUB 700: IF NOT' Y THQJ GOSUB 740: GOTO 540
570 GOSUB 690: PCa<E 38331,A: PC»E 38330, B: POKE 38329, C: CALL 38332
580 Y = 1: GOSUB 770: IF NOT' Y THEN 670
590 N = PEEK (6) + PEEK (7) * 256: GOTO 610
600 A = PEEK (38329 - N) * 65536 + PEEK (38328 - N) * 256 + PEEK (3832
7 - N) :AS = STR$ (A)
610 A$ = LEFT$ (A$,3) + "-" + RIGOT? (A$,4)
620 VTAB 16: PRINT "CiIJ5: ";A$
630 PRINT "NEW: ";A$: VTAB 17: HERB 6: INPUT "";A?
640 Y = 1: GOSUB 700: IF NOT Y THEN GOSUB 740: QCfTO 630
650 GOSUB 700: IF NOT Y THEN GOSOB 740: GOTO 640
660 GOSUB 690: PCKE 38329 - N,A: POKE 38328 - N,B: POCE 38327 - N,C
670 VTAB 19: PRINT " - ANCflHER CHANGE? - Y/N": VTAB 19: MAB 28: GET Q$:
PRINT : IF Q$ = "Y" THEN 530
680 GOTO 240
685 : : REM s :OCMVERT TO MODULO
690 A = INT (X / 65536) :B = INT(X / 256) - A * 256:C = X - A * 65536 -
B * 256: REOTRN
700 IF ^aD5 (A$,4,l) = "-" 'IHENA$ = LEFT? (A$,3) + RIGHT? (A$,4)
710 IF LEM (A?) < > 7 THEN Y =
720 X = VAL (A$): REMURN
730 VTAB 5: HEfiB 1: CALL
- F) / 3: REOTRN
:: REM itlLL. ENTRY WARNING
VTAB 21: PRINT " - IU£GAL ENTRY - PIZASE REENTER": FOR I
0: NEXT : VTAB 21: CALL - 958: RETURN
: : REM : :AUmO HAFMING
FOR I = 1 TO 3: FOR J = 1 TO 15:X = PEEK ( - 16336) : : NEXT : FOR K =
1 TO 10: NEXT K,I: REJIURN
TEXT : HCME : VTAB 16: PRINT " - OOPS - PAST PRESENT STORAGE CAPACIT
Y": VTAB 18: HEAB 30: PRINT "SORRY -": VTAB 23: GET Q$: GCnO 240
IF PEEK (38331) = 255 THEN VTAB 14: PRINT " - NO SUCH NO. CN RBODR
D -":Y =
RETURN
TEXT : HCME : VTAB 12: PRINT "- DO YOU WISH TO RETTORN TO MAIN"
VTAB 14: PRINT "WITHOUT SAVING CHANGES - 7 - Y/N:": VTAB 14: HEAB 39
: GET Q$
IF Q§ < > "Y" THEN 240
END :: REM : :DEU:TE 'END' IF RETURN HOCK IN 905 IS USED
TEXT : HCME : VTAB 12: HTAB 8: PRINT "* * BUSY * *"
840 J$ = ",D2"
860 PRINT D$"UNLOCK PH-95";J$
PRINT D$"BSAVE PH-95 ,A36826,L1574"
PRINT D$"LOCK PH-95"
IF J$ = ",D2" THEN J? = ",D1": GOTO 860
TEXT : HCME : VTAB 14: WTPB 12: PRINE "* * END * * ": PCKE 37,22
: PRlWr
: REM ::INSERT HOOK HERB
EEL 905,1070
735
740
745
750
760
770
780
790
800
810
820
830
870
880
890
900
958: VTAB 5: PRINT "TOTKL LISTINGS: ",-(38326
1 TO 120
905
910
915
920
930
940
950
960
970
980
990
1000
1010
1020
REM : :THIS PROGRAM WILL
REM ::ENEER THE
REM : :MACHINE LANGUAGE
REM : :POREICN AND THEN
REM ::DEUnE ITSELF.
DIM A(73)
FOR I = TO 72: READ A(l)
PCKE 38327 + I,A(I): NEXT
DATA 182,149,0,0,0,169,179,133,6,169,149,133,7,169,184,133,8,169,14
9,133
tATA 9,160,3,208,6,169,255,209,6,240,38,177,8,209,6,240,15,56,165,6
1030 DATA 233,3,133,6,160,3,176,233,198,7,208,229,136,208,232,56,169,182
,229,6
1040 DA'EA 133,6,169,149,229,7,133,7,96,141,187,149,96
1050 D$ = CHR$ (4)
1060 PRIOT D$"BSAVE PH-95, A1000,U0,D1"
1070 PRINT D$"BSAVE PH-95,A1000,UO,D2": GOTO 840
22
MICRO - The 6502/6809 Journal
No. 38 - Jul
r
CONTINENTAL SOFTWARE
THE APPLE SOURCE.
For Apple owners only. Thor-
oughly tested, well documented
programs for business and pleas-
ure. All written by professionals.
Each checked out carefully by
experts in its field.
HYPERSPACE WARS
2 GAMES FOR THE PRICE OF 1 $29.95
48K Trek. Staidate 3421.
The Terraunion is being attacked.
You command United StarshipExcali-
bur. Your mission: destroy the deadly
Klepton invasion force. Four levels,
Novice to Master.
3-D Space Battle. Use your on-board^
scanners to search for alien ships in hi-
res three-dimensional space. Destroy
as many aliens as you can before you
run out of fuel or your ship is destroyed.
Hi-res graphics. Req. 48K, Applesoft in
Rom+1 disk drive. Dos. 3.2 or 3.3.
L.A. LAND MONOPOLY $29.95
Bankrupt your opponents while becom-
ing the richest player in the game. Buy,
sell, rent and trade to accumulate the
most cash and property. Two to six may
play. Computer is banker. Create your
own special version using streets in "
your own town.
Hi-res graphics. Req. 48K, Applesoft
in Rom+1 disc drive. Dos. 3.2 or 3.3.
HOME MONEY MINDER $34.95
Complete home financial system com-
bines an excellent Home Checkbook
Program with Budgeting. Transactions
by month by budget category. Bank
reconciliation. Budget for year. Total
expenses compared monthly and year-
to-date. Plus much more.
Req, 48K, Applesoft in Rom, 1 disk
drive +printer. Avail, in Dos. 3.3.
THE MAILROOM $34.95
Stores up to 750 names per disk. Prints
master lists and labels 1, 2 or 3 across.
Sorts in 5 seconds. Sort on any of 12
items, search any sorted item in 10-20
seconds maximum. Easy editing, cus-
tomized inputs.
Req. 48K, Applesoft in Rom, 1 disk ^
drive +printer (132 column capability
needed to print Master List.) in Dos. 3.3.
No. 38 -July 1981
THE COMPUTER PROGRABIMED
ACCOUNTANT FOUR MODULES
Buy all four now — or add as you
expand $175 each ($250 after 6/1/81)
The first programs for your Apple that
your accountant will like as much as
you do. Nobody makes it better — or
easier to use — than Continental Soft-
ware. Simple step-by-step instructions.
Excellent error checking. Modules can
be used individually, or integrated into
a complete Accounting System.
Manuals only: just $15 each.
CPAI GENERAL LEDGER.
True double entry bookkeeping with
complete, accurate audit trails show-
ing the source of each entry in the
general ledger. Concise, meaningful
reports generated include Balance
Sheet, Profit & Loss Summary, Trial
Balance and Complete Journal Activity
Report. Reports show monthly, year-to-
date and last year monthly +YTD for
comparison. Custom charting feature
includes hi-res plotting of one or more
accounts.
CPA2 ACCOUNTS RECEIVABLE
Prints invoices on available custom
I forms or on plain paper. Back orders
1 and extensions computed. Issues state-
ments for all customers, one or more
customers, or only those with current,
30-, 60-, 90- or 150-day balances.
Maintain up to 300 customers. Custom-
ized journals. Allows simulation of
manual special journal entries. Posts to
General Ledger. Prints aging report to
150 days. Also prints customer lists
and labels.
CPA3 ACCOUNTS PAYABLE
Prints checks to vendors and non
vendors on available pre-printed
checks or plain paper. Each check stub
shows invoice(s) paid, discounts taken,
net paid, Prints Purchases and Cash
Disbursement Journals. Customized
journals. Allows simulation of manual
special journal entries. Prints Aging
Report to 150 days, vendor list and
labels and even a Cash Requirements
Report. Posts to General Ledger.
CPA4 PAYROLL
Maintains personnel records for as
many as KX) employees. Quarter-to-
date and year-to-date earnings and
deduction records. Employees are
departmentalized and designated
hourly or salaried. Prints complete
Payroll Checks, 941 information, W-2s,
State of California DE-3 information.
Prints Payroll Journal and posts to
General Ledger.
These are just some of the fea-
tures of each CPA module. All require
48K, Applesoft in Rom, Dos. 3.3, 2 disk
drives +printer.
At your local dealer or fill out and
mail today. Phone for immediate
delivery.
OKJILBYTE.
12101 Jefferson Blvd.,
Culver City, CA 90230
I
Send me these revolutionary
I programs:
■ D Hyperspace Wars . . . $
D L. A. Land Monopoly.
m D Home Money Minder
■ D The Mailroom
■ D CPAI General
B Ledger
I D CPA2 Accts. Rec. . .
_ D CPA3 Accts. Pay. . .
■ DCPA4 Payroll
I No. C.O.D.s Subtotal
Cal. res. add 6%
TOTAL
Name
Address.
City_
_ State.
ard No..
M17/81
_Zip_
.Exp._
CONTINENTALMSOFTWARE
(213) 371-5612
MICRO - The 6502/6809 Journal
I
I
I
I
I
I
I
I
I
I
I
■
I
I
I
I
■
23
Recreational
DISCOVER Where Learning is Fun , ^
And Recreation Becomes Educational I g^^..^
Computers and Learning . . .
Games and the Arts . . .
Kids Who Compute . . .
Programming Problems & Solutions. . .
Adventure . . .
Written with the Beginning and Intermediate Computerist
in Mind
All the exciting topics you can imagine fill each issue of
RECREATIONAL COMPUTING. *How can your computer help
you and your family? *What is the best software to buy? *Is the
newest hardware always the best? *How can you better use your
computing power? Our pages answer these questions and more!
RECREATIONAL COMPUTING is easy to read, and makes
the important topics easy to understand. Join us in exploring the
pleasures and uses of small computers. Subscribe now and learn
why we were the first personal computing magazine, and growing
faster than ever!
SUBSCRIBE TODAY!
You won't want to miss a single issue.
] Yes! Please enter my
1 issues).
subscription
for
1 year
(6
i n I enclose $12.
1 D Please bill me.
1 Name
1 Address
1 Tity, State^ Zip
1 Dept. T10, P.O. Box E, Menio Park
CA
94025
Are you ready
to take
the next step ?
Dr. Dobb's Journal
For users of small computer ' systems.
Let the Doctor's prescriptions fill you with the most
vitalizing, up-to-the-minute information for you and
your Micro!
These new remedies include the latest in operating systems,
programming languages, hardware design and architecture, data
structures, telecommunications and more.
Recent articles have included: Analysis of the 6502's Op-
codes, A Z80 Memory Test, N-Logs: A New Number Language
for Scientific Computers, CP/M to Pascal File Conversion, and in-
depth hardware and software reviews.
All this and more for only $21 per year - 12 issues!
Yes! Please enter my subscription for 1 year (12
issues).
□ I enclose $21.
D Please bill me.
Name
Address-
City, State, Zip_
Dept. T10, P.O. Box E, MenIo Park, CA 94025
24
MICRO - The 6502/6809 Journal
No. 38- July 1
/MCftO
Club Circuit
Apple Bit 'N Pieces Educators Group
This group of math teachers meets on
the first Thursday of each month ex-
cept during summer. Purpose of group
is to exchange ideas and programs. For
more information please contact:
Pat Calabrese, Dept. Chairman
JS Wilson Middle School
Apple Bit'N Pieces
Educators Group
901 West 54th Street
Erie, PA 16509
Toronto PET Users Group
Membership in this fast-growing club
now totals 430. Members receive a
subscription to The Target, as well as
access to all progrsuns (1400) in the
disk library. Regulai: dues are $20, and
student and associate dues are $10 per
year. For more information contact:
Chris Beimett, Secretary
Toronto PET Users Group
381 Laurence Avenue West
Toronto, Ontario
Canada M5M 1B9
Computer Programs
for Investment Management
As an investor, you can obtain
professional-quality management pro-
grams by belonging to a professional,
nonprofit group called the Micro-
Computer Investors Association
(MCIA). Since 1977 the Association
has published a journal. The
MicioComputei Investor. The journal
has a wealth of information and pro-
grams for investors who use micro-
computers. For membership applica-
tion and an index of all programs and
articles published to date, send $3.00
for an inJEormation packet to:
Jack Williams, MCIA
902 Anderson Drive
Fredericksbmg, Virginia 22401
Forth Interest Group
This group meets the fourth Saturday
of the month at noon and has a
membership of over 1200. The club
puts out a publication called "Forth
Dimensions." For fuirther information,
contact:
Jim Floumay .Ancon
17370 Hawking Lane
Morgan Hill, California 95037
No. 38 -July 1981
Attention Educators
Affiliated with the Cleveland Digital
Group, this club's primary objective is
the investigation, discovery, and ex-
change of functional and iimovative
computer-aided instruction ideas
among interested computer, mini-
computer, or microcomputer users
and/or owners. Monthly meetings are
held every third Sunday at the
Cleveland Heights-University Heights
main library, 2345 Lee Road, Cleveland
Heights, Ohio. If interested, send a self-
addressed stamped business envelope
to:
Joyce Townsend
P.O. Box 18431
Cleveland Heights, Ohio 44118
or call (216) 932-6799
Dental Computer Newsletter
For medical and dental professionals
using micro- and minicomputers for
treatment and office piuposes. Member-
ship is over 1500. Meetings are held at
the address below. For more informa-
tion, contact:
E.J. Neiburger, DDS, President
1000 North Avenue
Waukegan, Illinois 60085
OSI - MUG
Ohio Scientific
Michigan User's Group
This group has a membership of
approximately 130 people. It is in-
terested in contacting other user groups
and anyone wishing to become a
member. For information write:
Ralph V. Johnson, Sec.
OSI — MUG
3247 Lake wood Avenue
Arm Arbor, Michigan 48105
Apple Power Users Group
This group meets the second or third
Wednesday of every month (7:00 p.m.]
at Syosset High School, Syosset, Long
Island, New York. Jim Lyons is presi-
dent of the club, whose membership is
now 1 10 and expanding. There is a bi-
monthly newsletter, "The Pits," and
yearly dues are $20 which includes a
free subscription to the newsletter,
computer hardware and software dis-
counts, feature demonstrations and
presentations at all meetings and an ex-
tensive program library. For informa-
tion concerning membership, library
program exchanges, newsletter ex-
changes, etc., please contact:
Apple Power, c/o m. Lack
8 Division Street
Holtsville, Long Island,
New York 11742
MICRO - The 6502/6809 Journal
MICRO (East Brunswick Junior Com-
puter Club)
This group whose members are in
grades 7-12 meets twice a month at the
East Brunswick Public Library. The
main purpose of the group is to teach
beginners about computers. For addi-
tional information, please contact:
Larry Kaplan, Secretary
28 Green Hills Road
East Brunswick, NJ 08816
Microcomputer Users International
This club meets on the third Tuesday
of each month. NoTtbem Bytes is the
group's monthly newsletter. For more
club information, or to arrange for a
newsletter exchange, contact:
Jack Decker, Newsletter Editor
1804 West 18th St., Lot 155
Sault Ste. Marie, MI 49783
The Apple Guild
The Apple Guild is an organization
whose purpose is to promote the inter-
change of information and applications
among Apple microcomputer users. In
addition to holding monthly meetings,
The Guild supports a sophisticated,
computerized, telecommunication
system (617-767-1303); maintains a
collection of hardcopy material and
software at its Apple Resource Center
located at Massasoit Community Col-
lege (Brockton, MA); and plans to
publish a quarterly journal. Member-
ship requests and other inquiries
should be sent to:
The Apple Guild
P.O. Box 371
Weymouth, MA 02188
Wondai Apple Users Group (W.A.U.G.)
This group of 20 members meets twice
a month, and publishes a monthly
newsletter called Waug-Waug. The
group aims to exchange and promote
Apple ideas and reviews. Contact:
Dr. P. Lip
P.O. Boic 19
Wondai Old 4606
Australia
OSI Users Group Wellington
This group of 30 people meets on the
3rd Thursday of each month at 7:30
p.m. at Computer Consultants Ltd.,
Wingate Lower Hutt. The club arranges
a guest speaker, and provides an OSI
microcomputer for members to use.
Aims include exchange of ideas and
information, plus tuition of machine
code. Membership is $5 annually.
Contact:
Derryl Cocks (Vice Pres.)
27 Tawa Tenace
Tawa, Wellington, New Zealand
25
r
I
I
I
I
I
I
I
I
■
Don't buy Apple Software
until you read this book.
First check The Book— the one complete critical analysis of most Apple
Software available. Games, Educational, Business, Utility programs and
more. Each comprehensively rated on 11 separate points. Each reviewed by
an expert in its field. Just $19.95.
Now you can compare and get more for your software dollar. Does the
program you need exist? How good is it? Which software vendors offer the
best support? Find out all this and much more.
MasterCard & Visa accepted. Fill out and mail today or call for shipment.
NAME
ADDRESS _
CITY
CARD NUMBER.
.STATE _
_ZIP_
Calif, residents add 6%
16720 HAWTHORNE BLVD., LAWNDALE, CA 90260. (213)371-4012.
TheBookCompaiiy
GET FREE SOFTWARE FOR YOUR APPLE!!!
HOW? Just order any of the items below, and for every $100 worth of merchandise order an item
from the Bonus Software Section at NO COST! C.O.D. & Personal Checks accepted for all orders.
HARDWARE BY APPLE
VIDEO MONITORS
SOFTWARE by Others
APPLE II PLUS, 48k
1199
Leedex-VWeo-lOO ir B&W w/Cable
139
PEACHTREE BUSINESS SOFTWARE
CALL
DISK DRIVE+CONTROLLER (a3l
535
Leedex 17' Green w/Cable
165
VISICALC
120
DISK DRIVE only
445
Leedex 13" COLOR MONITOR & cable
399
E2WRITER PROF. SYSTEM
229
Language System w. Pascal
397
APPLE FORTRAN by MICROSOFT
159
Silentype Printer gi Interface
549
APPLE BASIC COMPILER by MICROSOFT
315
Graphics Tablet
159
645
SOFTWARE by APPLE
APPLE COBOL by MICROSOFT
MUSE SUPER-TEXT II
599
139
Parallel Printer Interface Card
Hi-Speed Serial Card
149
155
APPLE FORTRAN
APPLE PILOT
159
125
PROGRAMMA APPLE PIE
119
HARDWARE by Others
HARDWARE
PRINTERS
HAYES MICROMOOEM II
VIDEX VIDEOTERM 80 W. GRAPHICS
300
320
by Mountain Computer
EPSON MX-80
515
MICROSOFT 280 SOFTCARD
269
Qock/Calendar Card
239
EPSON MX-70W. GRAPHICS
415
MICROSOFT 16k RAMCARD
159
A/D & D/A Interface
319
CENTRONICS 737
737
CORVUS 10MB HARD DISK
CALL
Expansion Chassis
555
NEC SPINWRITER 5510 RO
2795
SSM AlO SERIAL/PARALLEL A&T
189
ROMplus Card
135
VISTA V300 DAISY WHE E L 25CPS
1750
MICRO-SCI Disk & Controller
495
Mark Sense Card Reader
995
VISTA V300 DAISY WHEEL 45CPS
2025
BONUS SOFTWARE HERE!
Ut ut acquaint you with MESSAGE-MAKING SOFTWABE.
Juft placa tha diak in th« APPLE, antar tha taxt, and colorful,
dynamic matngaa appaar on tha tcraent of TV tat* eonnactad to
tha eomputar. Uaa tha toftwara to broadcatt ma»M0«i on TV
•craant in achooli, hoapttali; factorial, ttora windows, axhibit
boothih ate Tha f otlowlng prooram la our latast ralaaw:
SUPER MESSAGE: Cravtos maangat )n full-paga "chunkf".
Each maiaaoa allows statamants of mixad tvpottylai. typatlzas
and colors, In mixad uppar and lowar casa. Stylos ranga from
ragular APPLE eharactari^ up to doubto-tfza^ doublo-width ehar^
actars with a haavy, bold font. Six colors may ba uaad f or aach
diffarant typattylaL Vartlcal and horizontal cantaring ara avail*-
bta, and word-wrap is automatic. Usars can chain paoas togathar
to maka multf-paga masaagas. Pagas can ba advancad manually
or automatically. Multl-paga nrtasaagas can ba storad to diac or
racallad Instantly.
REQUIRES 48K & ROM APPLESOFT , $ sa
APPLE PLOTS YOUR DATA A KEEPS YOUR nECOftDS TOO
APPLE DATA GRAPH Z1: Plots up to 3 suparlmpoaad curvas
on tha H^raa Scraan both tha X A Y axas dimanalonod. Each
curva consists of up to 120 plocos of dat& Graphs can ba storad
to disc and racallad tmmadiataly for updating. Up to 1 00 grwha
can ba storad on tha safn* diaa Groat for Stock-markat Charting,
Buslnass Managomant, and Ctaasroom InstructlonI
REQUIRES 48 K ft ROM APPLESOFT „$ 401
APPLE RECORD MANAGER: Allowfl conr^lata fllas to ba
brought into mamory so that raoord saar ch a s and manipulations
aro InstantanaouL Racords within any flla can contain up to
20 flakJs, with usar-daf Inad haadings. Information can ba string
or numarlc. Uaars can browsa thru f Itas using pao»-f orward. pago-
backward or random-saoreh commands Racords can aastly ba
•aarchad, altarad or sortad at wllL Fllas can ba storad on tha
sama driva as tha nrMStar prf>gram, or on anothar, N a sacond driv*
bavallabla. Racords or fllos can ba prin^d. If daslrad.
Additional modulas coming ara a STATISTICS INTERFACE,
CHECKBOOK, MAILING LIST ft DATA-ENTRY.
REQUIRES 48K& ROM APPLESOFT $ 3&
' All Softwara abova on Disk for APPLE DOS 3.2, oorwartibla
to a.3.
26
CONNECTICUT INFORMATION SYSTEMS CO.
218 Huntington Road, Bridgeport, CT 06608 (203) 579-0472
MICRO - The 6502/6809 Journal
No. 38 - Jul
11
I
■1
I]
4
I
I
I
I
I
I
I
It's Time to Stop Dreaming,
Part 2
Robert M. Tripp
Editor/Publisher
MICRO
Part 1 (MICRO 37:9) presented the
Motorola 6809 microprocessor — a can-
didate for serious consideration as a
successor to the 6502. The four major
points made were:
1. No manufactixrer has annoimced
plans to develop an improved
6502;
2. The 6809 is closely related to the
6502 in basic architecture,
philosophy and instruction set;
3. The 6809 has a number of im-
provements v/hich make it very
powerful and a worthy successor
to the 6502; aind,
4. While the 6809 is relatively new,
there are already a large number
of hardware and software pro-
ducts available. These include
upgrades for existing 6502
systems — tlae SYM and Apple
for example — as well as totally
new products, such as Commo-
dore's brand new "Micro-
Mainframe," the Radio Shack
Color Computer, and others.
This article, pan; 2, will concentrate
on describing some of the improve-
ments which make the 6809 a rather
remarkable device.
The 6502, 6800 and 8080 micro-
processors, were designed to be process
controllers, not miarocomputer bmlding
blocks. Therefore, while they could be
used as the "brains" of microcom-
puters, the many design trade-offs that
had been made based on their intended
use as relatively simple, ROM-oriented
process controllers resulted in limita-
tions when used in microcomputers.
The designers of the 6809 had a totally
different charter. They set out from the
start to build a new device which would
be used primarily as the intelligence of a
microcomputer. Many of the individual
new features work together to provide
important new capabilities.
Position-Independent Code
In a dedicated microprocessor con-
troller application there may not be any
reason to write position-independent
code. After all, the program is probably
in ROM and is unique to the applica-
tion. There are, however, many good
reasons to write position-independent
code in a general-pvirpose microcom-
puter. Different hardware configurations
may require that the program reside in
different address spaces. In a disk-based
system, various software modules may
want to be resident in numerous com-
binations. If each module can only run
in a specific address space, then there
are severe restrictions on which
modules may co-exist. Given a suffi-
ciently well-defined set of interfacing
rules, it will even be possible to write
software modules which can operate on
a variety of microcomputers.
There are four major improvements
the 6809 offers which directly affect its
capability to support position-
independent code. These include:
1. Long Branches which permit
relative branching to any location;
2. A Branch to Subroutine insdruc-
tion which permits relative
branching to a subroutine;
3. Addressing relative to the Pro-
gram Cotmter;
4. The Load Effective Address in-
struction which permits the
address calculated by many com-
plex addressing modes to be
directly accessed.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
Long Blanch. (This does not refer to
the saloon which was so popular in
Gunsmoke.) As anyone who has worked
in assembly level programming on the
6502 can testify, the limitation of the
Branch instructions to plus/minus only
128 locations (decimal) can be a real
nuisance as well as a real restriction.
The 6809 instmction set includes two
addressing modes for all of the Branch
instructions.
Short — identical to the 6502 with
one byte of offset requiring the target
address to be within 128 bytes of the
cunent program counter; and.
Long — which has two bytes of off-
set permitting the target address to be
anywhere in the normal 64K memory.
The Long Branch obviously makes
life easier by eliminating the need for
branches to branch to branches, etc., to
accomplish a branch to an address out-
side the one byte addressing range. Since
it is program-cotmter-relative, it pro-
vides most of the solution to the prob-
lem of transferring control to other
addresses in a relative way, which
makes it position-independent. The
6502 "can" branch to any relative loca-
tion in memory by having one branch go
to another branch to another branch un-
til the target is reached, but this can get
so complicated and difficult to maintain
that it is generally not practical. The
Long Branch improvement in the 6809
is significant.
Biancb to Subioutine. The 6502 does
not have any direct method for making a
relative branch to a subroutine. This is
probably the single most serious prob-
lem encountered in trying to write
position-independent code. There is no
simple solution. One can make all
subroutine calls via a fixed table, which
is itself updated as the code is moved
around in memory. Or a special soft-
ware processor can be written, which
traps all subroutine calls and calculates
the actual address. Another alternative
27
is that code can be written which will
function in a manner similar to a
subroutine but will perform some sort of
test to determine where to retiim to so
that it may be called via a normal
branch. There are other methods as
well, but, every technique for getting
around the lack of a Branch to Sub-
routine instruction involves tricky code,
additional memory, extra instruction
cycles, and can be difficult to maintain
and/ or debug.
The 6809 does have a straight-
forward Branch to Subroutine (BSR)
which operates exactly as one would
expect. It is just like the Jump to
Subroutine [JSR) of the 6502 except that
it is a branch relative to the Program
Coimter, not an absolute jump. Like all
other Branch instractions on the 6809,
it can be short (BSR — one byte offset) or
long (LBSR — two byte offset), thereby
allowing the Branch to have a target
anywhere in memory.
BSR NEWTST
(control will go to NEWTST)
(subroutine will return control to
here)
NEWTST (same code)
RTS
(Return from Subroutine
instruction)
Addressing via the Piogiam Cotmtei.
The improved Branch instructions solved
one major PIC problem — that of pass-
ing program control in a relative fashion
throughout the whole memory and to
subroutines. The major problems re-
main: how to address data (individual
values, tables, lists, messages, etc.) in a
relative way to preserve the PIC. On the
6502 there is no simple way to access
data relative to the current value of the
program counter. Some tricks, similar
to those mentioned to provide relative
subroutine calls, can be used, but they
all have drawbacks and increase both
time and space requirements. The 6809
provides Program Coimter Relative
Addressing. This form of addressing is
almost identical in concept to the
Branch addressing. The offset may be
either one byte or two bytes, and is add-
ed to the current value of the Program
Counter Register (PCR) to determine the
absolute address. While the Branch
operation is normally written in the form
BEQ JUNK
it actually adds the signed value of
JUNK to the Program Counter Register.
The Branch may therefore be considered
to be of the form:
BEQ JUNK.PCR
(add the signed value of JUNK,
which may be one or two bytes,
to the Program Counter and set
the Program Counter to the new
value)
It can then be seen that the Program
Counter Relative address is identical
since it has the form:
LDA JUNK.PCR
(add the signed value of JUNK,
which may be one or two bytes,
to the Program Counter and load
the A register from the calculated
address)
This provides the solution for
accessing any single memory location in
a PIC fashion. The memory at any
address may be loaded, stored,
incremented, tested, compared, com-
plemented, and so forth with PCR
addressing, thereby providing support
for PIC.
Loading Effective Addresses. While
the Program Counter Relative address-
ing supports accessing single memory
address, it would be very useful to be
able to get the absolute address of a
table, list or message into an index
register so that the whole table could be
readily accessed. This is one of the
features of a very useful new 6809 in-
struction: Load Effective Address (LEA).
The application of this instruction here
is but one of many uses. Other uses will
be discussed later. The LEA instruction,
in combination with the PCR address-
ing, allows an index register to be loaded
with an absolute address which is
calculated relative to the current Pro-
gram Counter. The form is identical to
that discussed for the Branch and Pro-
gram Relative Addressing:
LEAX TABLE,PCR
(add one or two byte offset to the
current Program Counter and
place this value — the Effective
Address — in the X index
register)
The X register now contains the ab-
solute address of the location TABLE.
Since the 6809 supports a nxunber of in-
dexing modes — Zero Offset Indexed,
Constant Offset Indexed, Acciunulator
Offset Indexed, Auto Increment/Decre-
ment Indexed and Indexed Indirect —
this ability to obtain the absolute ad-
dress relative \to the Program Covin
solves a lot of the normal problei
encotmtered in generating PIC.
Position-Independent Summai
While writing PIC on the 6502 is pos
ble, it is not an easy task and alwa
adds considerable complexity a:
overhead. I wrote two versions of
video driver to run anywhere in an All
SYM or KIM. In both versions, the pi
gramming required to provide PIC w
more complex than any of the code :
quired to support the numerous vid
functions! The support that the 68
has added would make a similar modi
almost trivial to create PIC. The rrn
improvements of the 6809 which dire
ly support PIC are: Long Brand
which are relative to any address frc
any address; the Branch to Subrouti
instruction which permits relative :
dressing of subroutines,- the addressi
of locations relative to the Progr.-
Counter; and the Load Effective Addr(
instruction which can calculate t
absolute value of a relative address a
make it available for the numerc
indexed instructions and indexi
modes. With all of these added suppo
for position- independent coding, there
no reason to write position-depends
code on a 6809 microprocessor-bas
system.
The VersatUe Stacks
The Stack plays a very import;
part in the operation of every significi
microprocessor, including the 65(
The Stack is a basic part of the hardw;
interrupt processing, is required for s:
ing the return address during a si
routine call, and can be used as te
porary storage, to pass parameters, a
so forth. Unfortunately, the 6502 off
only limited Stack support. It has oi
one Stack, which is limited to 256 by
and must reside on page one (0100
OlFF). There are very few Stack instri
tions: TXS (set Stack Pointer from
register), TSX [put Stack Pointer intc
register], PHA (Push A register
Stack), PLA (Pull A register from Stac
PHP (Push Status on Stack], and F
(Pull Status from Stack) . Other instr
tions such as JSR, RTS and RTI use i
Stack, but would not normally be ci
sidered Stack support instructio;
Although there are many uses c
would like to make of the Stack, on i
6502 the support is limited.
The 6809 makes full use of the Sti
concepts. This is done in a number
ways:
1 . There are two Stacks — a Syst
Stack and a separate User Sta
28
MICRO - The 6502/6809 Journal
No. 38 -July IS
2. The Stack Pointers have all of the
same indexing; modes as the X
and Y registers.
3 . Any combination of registers may
be Pushed/PuJled from either
Stack in a single instmction.
4. The Load Effective Address may
be used with the Stack registers.
5. Each Stack register is 16-bit,
meaning that Stack may be up to
64K bytes and may be located
anywhere in memory.
Each of these improvements to the
Stack support can have varying degrees
of importance, depending upon the
application. The overall effect of these
improvements is the creation of a whole
new facility with new ways of perform-
ing many programming tasks. Since the
6502 has limited Stack support it is not
surprising that the Stack is not normally
used for much beyond its subroutine, in-
terrupt, and occasional short-term
storage. With the 6809 features, many
new ways of using tlie Stack become
possible.
One difficulty in using the Stack of
the 6502 is that it must be "shared"
with the hardware. Interrapts and
subroutine calls are forever putting
things on and takinj; things off the
Stack. The User Stack on the 6809 does
not have this problem. All hardware and
subroutine service is handled by the
System Stack, leavini; the User Stack
alone. Since all of the indexing opera-
tions are available to the two Stack
Pointers, which are treated as two addi-
tional 16-bit registers, many operations
are possible on the Stack that would be
too complicated for the 6502.
A number of programming problems
may be solved using Stacks. These in-
clude position-independent, re-entrant,
and recursive coding. Many high level
languages can be programmed to be
more efficient if there can be free and
easy access to Stack operations. An ex-
ample of the improved 6809 Stack
operation is the use of the Load Effective
Address instmction to modify the Stack
Pointer. Compare the following pro-
cesses for moving the Stack Pointer for-
ward 20 (decimal) positions on the 6502
and the 6809.
6502;
STX
STA
XTEMP Save X register in
some memory location
ATEMP Save A register in
some memory location
TSX
TXA
CLC
Put current Stack
Pointer into X register
Move current Stack
Pointer into A register
Clear carry for addition
ADCIM #$14 Add 20 (decimal) to
the current value
TAX
TSX
Put new value into X
register
Put new value into
Stack Pointer
LDA
ATEMP Restore A register
LDX
XTEMP Restore X register
6809:
LEAS
14,S Load Effective Address
! No. 38 -July 1981
into Stack register =
cvirrent Stack value
+ 20 [decimal)
This operation could be used to clean up
the Stack after it has been used for tem-
porary storage. It is obviously very sim-
ple on the 6809, and probably more
trouble than it is worth on the 6502.
The 6809 makes it easy to access
data on the Stack. The Transfer instruc-
tion can be used to copy the Stack
Pointer into any other index register,
and then operations can be made
relative to the index register without
disturbing the Stack Pointer.
TFR X,S
Will copy the 16-blt Stack Pointer
to the X register
All of the indexed operations may now
be performed on the X register without
any involvement of the Stack Pointer.
Typical applications would be to pass
subroutine parameters between the call-
ing program and the subroutine on the
Stack with the index register being used
to access the various paramaters in any
order as required. Then, as the Stack
Pointer may be changed due to various
operations, the reference pointer can
stay fixed.
LDA -5,X
to refer to a location five locations
below the position of the Stack
Pointer at subroutine entry
The useful programming techniques
which depend on stack-type operations
are very well supported by the 6809.
Other New Products
The Radio Shack new Color Com-
puter is 6809-based. At this time I do not
have enough information to give a fuU
report of its feattires, but hope to have
this information for a column soon.
MICRO - The 6502/6809 Journal
Commodore has armounced the
"Micro-Mainframe," a new 6809-based
microcomputer with a large body of
software developed by Waterloo Com-
putering Systems. This product will be
in the $2000 range, complete with
micro BASIC, micro PASCAL and other
languages, and is supposed to be
available by the end of this year.
The Computerist has announced
that its new multi-controller board will
offer the 6809 as one of its many op-
tions. The board will provide controllers
for floppy disks, IEEE-488 bus, RS-232
communication, cassette interface, up
to 56K memory in any combination of
RAM, ROM and EPROM, plus parallel
and serial I/O ports. Initial deliveries are
scheduled for this summer.
Last month's column mentioned a
munber of manufacturers of 6809-based
hardware and software, but did not give
the addresses. A "6809 Resource List"
at the end of this installment provides
this additional information. If your
company has a 6809-based product, send
along as much information as possible
to me so that you may be covered in
future colmnns. If you have had ex-
perience with the 6809, in almost any
environment and on any equipment,
please consider writing about it for
MICRO. Our readers are anxious to keep
abreast of the rapid developments in this
area and will appreciate hearing from
feUow readers.
6809 Resource List
Technical Systems Consultants Inc.
Box 2570
West Lafayette, Indiana 47906
Percom Data Co., Inc.
211 North Kirby
Garland, Texas 75042
Softech Microsystems, Inc.
9494 Blue Motmtain Road
San Diego, California 92126
Computer Systems Center
7413 N. Lindbergh Boulevard
St. Louis, Missouri 63132
Ackerman Digital Systems
HON. York Road 208
Elmhurst, Illinois 60126
Canon USA Inc.
10 Nevada Drive
Lake Success, Long Island
New York 11040
Commodore Business Machines, Inc.
681 Moore Rd.
King of Prussia, Pennsylvania 19406
(Continued)
29
r
Motorola Semiconductor Prod. Inc.
P.O. Box 20912
Phoenix, Arizona 85036
Smoke Signal Broadcasting
31336 Via CoUinas
Westlake Village, California 91361
Forth Inc.
2309 Pacific Coast Highway
Hermosa Beach, California 90254
Microware Systems Corp.
5835 Grand Avenue
Des Moines, Iowa 50304
Phoenix Digital
2315 North 35th
Phoenix, Arizona 85009
Software Dynamics
211 West Crescent
Anaheim, California 92801
Informer Inc.
P.O. Box 91054
Los Angeles, California 90009
Stellation Two
P.O. Box 2342
Santa Barbara, California 93120
The Computerist Inc.
34 Chelmsford Street
Chelmsford, Massachusetts 01824
jycRo
MIOK)
/f=
AVAILABLE NOW!
THE INTERNATIONAL
MICROCOMPUTER
SOFTWARE
DIRECTORY
ONLY $28.95 + $2.95 post.
5000 entries, cross-referenced
by machine, 0/S, application,
vendor and program name.
Phone or write for details. All
major credit cards accepted.
IMPRINT SOFTWARE
US • 420 South Howss St., Ft. Collins, CO
80521 ■ Tel 303 482 5574
UK - 16 Milton Avenue, HIgtigate, London N6
Tel 01 348 3998
New Publications
J)
Mike Rowe
New Publications
P.O. Box 6502
Chelmsford, MA 01824
General 6809
6809 Miciocomputei Piogramming &
Interfacing, With Experiments hy
Andrew C. Staugaard, Jr. Howard W.
Sams & Co., Inc. (4300 West 62nd
Street, Indianapolis, Indiana 46268),
1981, 270 pages, diagrams, photos,
tables, 5 3/8 x 8Vi inches, paperbound.
ISBN: 0-672-21798-8 $13.95
This book is designed as a tutorial type
of text or "cookbook" for a first
exposure to the 6809, a bigb-
peifoimance 8-bit microprocessor, or to
high-performance microprocessors in
general. According to the author, the
6809 approaches the performance of
many 16-bit devices, without the
overhead costs required to engineer
such a 16-bit system.
CONTENTS: fundamental 6809 Concepts
and Chip Stmcture— Introduction; Objec-
tives; 6809 Evolution and Design
Philosophy; 6809 Improvements; 6809 Chip
Structure; Review Questions; Answers.
6809 Addressing Modes — Introduction; Ob-
jectives; Inherent, Immediate, and Extend-
ed Addressing; Direct Addressing and the
Direct Page Register Relative Addressing;
Indexed Addressing; Post Byte; Indirect Ad-
dressing; Register Addressing; Review Ques-
tions; Answers. 6809 Registers and Data
Movement Instructions — Introduction; Ob-
jectives; 6809 Intemal Register Format;
Data Movement Instructions; Review Ques-
tions; Answers. Aiitbmetic, Logic, and Test
/DStructions— Introduction; Objectives;
Arithmetic Instructions; Logic Instructions;
Test Instructions; Review Questions;
Answers. Biancb and Miscellaneous Instmc-
tfoiis— Introduction; Objectives; Branch In-
structions; Miscellaneous Instructions;
Review Questions; Answers. 6809/6809E
Input and Output Signals— Introduction;
Objectives; 6809 Pin-Outs; 6809E Pin-Outs;
Review Questions; Answers. 6809/6809E
Interfacing and Applications— iaxioiactioB.)
Objectives; A Minimum 6809 System; An
Expanded 6809 System; Multiprocessor
Systems; Remote Data Acquisition; The
MEK6809D4 Microcomputer Evaluation
System. Appendices A: 6809/6809E Im
tion Set— Operation Notation; Rej
Notation; Definitions of Executable Ins
tions. B. The 6820/6821 Peiipbeial .
face Adapter {PIA)—6i,l\ Funct
Description; 6820/6821 Pin Assignrn
PIA Interfacing and Addressing; PL
itialization and Servicing; Review (
tions; Answers. C. Specificc
Sieets— MC6809/MC68A09/MC6f
MC6809E / MC68A09E / MC68)
MC6829; MC6839; MC6842; MEK68C
MEK6809D4/MEK68KPD. D. MC
Instruction Set Summary. Index.
Pascal
Pascal Primer by David Fox
Mitchell Waite. Howard W. San
Co., Inc. [4300 West 62nd St
Indianapolis, Indiana 46268), 1981
pages plus tear-out UCSD Pi
reference card, line drawings,
grams, listings, 8 5/8 x 11 1/8 in(
cardstock cover with Wire-O bind
ISBN: 0-672-21793-7 $1
This book was designed for people
have dabbled in BASIC and wai
learn programming in Pascal,
authors are committed to he!
readers master "Pascal without tei
CONTENTS: Introduction: An Overvi
Pascal—Skip This Chapter; How This
Is Organized; What Is Not Included; W
Pascal?; The Crisis That Gave Bir
Pascal; The Rat's Nest Analogy to P;
Not a Black and White World; Why Is I
Special?; The Parts of Pascal; A
History of the Language; A Present Da
ample: Apple Pascal. Pascal: Begii
Concepts— Program Structure: PROGl
BEGIN, END; WRITELN and WRITE;
sor Control: GOTOXY; Quiz. Variable
inputting— Variables; Variable T
Calculations; Quiz-Variables; REAJ
READ-Input Without Pressing "Ret
Quiz-Inputting; Other Variable T
REALS, BOOLEANs, LONG INTEC
Quiz-Other Variable Types. Procedure
First Time Around— Building Bl
Global and Local Variables; Proce
Calling Procedures; Nested Procec
Quiz-Procedures. Program Control
Loops— The FOR Statement; Variatio
FOR; Compound Statements; The
Payment Program; Expanding a Proj
(Continued on pag
30
MICRO - The 6502/6809 Journal
No. 38 -July
Singing the file transfer blues? Then..
Get: B. I.T.S.!
Use your Micromodem )C.' A I O Card, on
Apple Co mm Cand^ to:
Send daCa files, BASIC programs,
even nnachlne code
c o mos c computers over phone I ines.
Copy anything you see
into a 31K buffer then save it ondisl<
and/or print it under your complete C-ontnol.
Many more features!
See Ifc at your faworice computer
store today.
Trad«marhs hsid by:
1 - Hay«> Microcomputer Product* Inc.
2 • 5 S M
3- ApplaComputor Inc.
B.I.T.S. Is a tmd.marK of:
Mi(Bro8oftiMara ays«ams
7327 Jones Branch Dr. Suite 400
McLean, Virginia 22102
C703) 3B5-23-44
l^ecision
OyBtems
Decision Systems
P.O. Box 13006
Denton. TX 76203
SOFTWARE FOR THE APPLE II*
ISAIM-OS is an inlegrateil set of Applesoft routines tfiat gives indexed file capabilities
to your BA'SIC programs. Retrieve by key. partial key or sequentially. Space from
deleted records is automatically reused. Capabilities and performance that match
products costing twice as much.
$50 Disk, Applesoft.
PBASIC-OS is a sophisticated preprocessor for structured BASIC. Use advanced
logic constructs such as IF... ELSE..., CASE, SELECT, and many more. Develop
programs for Imeger or Applesoft. Enjoy the power of structured logic at a fraction of
the cost of PASCAL.
$36. Disk, Applesoft I48K, ROM or Language Cardl,
DSA-DS is a disassembler for 6502 code. Now you can easily dis-assemble any
machine language program for the Apple and use the dis-assembled code directly as
input to your assembler. Dis-assembles instructions and data. Produces code com-
patible with the S-C Assembler (version 4,0), Apple's Toolkit assembler and others.
$25 Disk. Applesoft I32K. ROM or Language Card).
FORM-OS is a complete system for the definition of input and output froms. FORM-
DS supplies the automatic checking of numeric input for acceptable range of values,
automatic formatting of numeric output, and rt«ny more features.
$25 Disk. Applesoft (32K. ROM or Language Card)
UTIL-DS is a set of routines for use with Applesoft to format numeric output, selec-
tively clear variables (Applesoft's CLEAR gets everything), improve error handling,
and interface machine language with Applesoft programs. Includes a special load
routine for placing machine language routines underneath Applesoft programs.
$25 Disk, Applesoft,
SPEED-DS is a routine to modify the statement linkage in an Applesoft program to
-speed its execution, improvements of 6-20% are common. As a bonus. SPEED-DS
includes machine language routines to speed string handling and reduce the need for
garbage clean-up. Author: Lee Meador,
$16 Disk. Applesoft (32K, ROM or Language Card).
(Add M.OO for'Foraign Mail)
* Appta II is a ragisterad trademark of the Apple Computer Co
Wl
INTERACTIVE QRAPHICSMAME UNOUAOE
FOR THE PET/CBM
r
Interactive language for your
Video Interactive Game
n easy to learn graphics and
you quickly create interactive
VIOIL is an exciting new
PET/CBM micro. VIOIL •
Interpretive Language ■ is ar
game language that lets
applications.
* More than 60 powerful commands permit you to easily manipulate graphics
figures on the screen
* Dout)le density graphics give you 80 X 50 plot positions on your-40 column
PET/CBM
* Large number display capability, access to two event timers and tone generation
(II you have ext. speaker)
* Load and save your VIQIL programs to cassette or diskette
* Nine interactive programs demonstrate the power of VIOIL • Breakout.
SpaceWar.AnllAircraft. U.F.O.. SpaceBattle, Concentration, Maze, Kaleidoscope
& Fortune
* Comprehensive user's manual with complete listings of
enclosed programs
VIOIL comes on caasette, or diskette ready to run on any 40 column
PET/CBM micro with at least 8K of memory. Specify ROM-set
when ordering. 6502 listing of the VIQtL Interpreter
available separately. US & Canada Fo,eign
VMM. FOR Pet/CBM on Cassette or DM<elte(w/9 programs) $35 S40
VIOIL User's Mannual (refundable with software) $10 $12
VniL Interpreter listing (6502 Assembly language) $25 $30
PET MACHINE LANGUAGE GUIDE $8 $10
mMKH!TI
II ili
ABACUS SOFTWARE
P.O. Box 7211
Grand Rapids, Michigan 49510
(616)241-5510
Prices include postage. Michigan residents include 4S sales tax. Orders must be
prepaid or via bwiKcard (Mastercard, VISA, Eurocard, Access, etc.). Include card
number and expiratkjn date.
(C) 1981 by Roy Walnwright
FESSENDEN COMPCTTER SERVICE
Flat Rate
DISK DRIVE OVERHAUL
One Week Turnaround Typical
Complete Senke on Cuircnt Remex, MPI and
Stiuowt Floppy Disk Drives.
FLAT RATES
8" Double Sided Drive *1 70.00*
8" Single Sided Drive $15a00*
5'/4" MJ>.L Drive *1 00.00*
'Broken, Bent, or Damaged Parts Extrn
You'll Be Notified of
1 . The date we received your drive.
2. Any delays and appixsdmate time of completion.
3. Date Drive was shipped from our plant
4. Repairs petfbmied on' your Drive.
5. Parts used (* arKl description).
6. Any helpful hints for nrxsre tellable peifoimance.
7. 90 Day Warranty.
8. Ship Your Drive Today.
9. Other Brands Accepted.
1 0. Write or call for further details.
PHONE (417) 485-2501
FESSENDEN COMPUTER SERVICE
116 N. 3RD STREET OZARK, MO 65721
1| No. 38 -July 1981
MICRO - The 6502/6809 Journal
31
T.M.
SENSIBLE SOFTWARE, INC. is pleased to introduce...
OUR 1981 COLLECTION OF SUPERIOR SOFTWARE FOR THE APPLE COMPUTER...
APPLESOFT-PLUS STRUCTURED BASIC [APLUS] SeS.OC
32K-I- , Disk II, ROM/RAM Applesoft, Apple ll/Apple 11 +
APLUS is a 4K machine language utility that adds the following structured programming commands to Applesoft basic: 1) WHEN.. ELSE.. FIN, 2) UNTIL, ;
WHILE, 4) UNLESS, 5) CASE, 6) SELECT (variable), and 7) (OTHERWISE). Multi-line IF.. THEN statements are also supported. APLUS allows the use
"named" subroutines or "procedures". The programmer can now instruct a program to "DO CURVE-FIT" without worrying about the location of ft
subroutine. APLUS automatically indents "&LIST"ed programs to clarify the logic flow. The APLUS "&CONVERT" command replaces the above structure
programming commands with "GOTO"'s and "GOSUB"'s to provide a standard Applesoft program as output. New programs can now be written usir
"GOTO "-less logic.
APPLESOFT PROGRAM OPTIMIZER [AOPT] SSO.OC
32 -H , Disl< II, ROM/RAM APPLESOFT, Apple ll/Apple 11 +
AOPT is a 2.2K machine language utility that will substantially reduce the size of an Applesoft program without affecting the operation of the program. AOI
automatically: 1) Shortens variable names, 2) Removes remarks, 3) Removes unreferenced lines, 4) Appends short lines together, 5) Removes extra colon
and 6) Renumbers line numbers. AOPT will convert a verbose, well documented, development version of a program into a memory-efficient, more secure, pr
duction version of the same program. This is the ORIGINAL and the BEST optimizer on the software market today!
DOS PLUS SSS.OC
32+ , Disk II, DOS 3.3, Apple ll/Apple 11 +
DOS PLUS is the software solution for living with both 13-sector (DOS 3.1. 3.2, and 3.2.1) and 16 sector (DOS 3.3) Apple diskettes, DOS PLUS adds 8 ne
commands to Apple DOS. Three of these are built-in and five are user definable. The built in commands include: 1) ".F" to "flip" between DOS 3.2 and 3
(The user need not re-boot and any program that resides in memory will not be affected by the flip. The.DOS version can even be changed within a program!),
".S" status command informs you what DOS version is currently active, and 3) ".B" BLOAD- analysis is also provided to inform the user of the starting ai
dress and length of the last accessed binary file. DOS PLUS also includes a DOS COMMAND CHANGER program to allow easy customization of Apple DOS con
mands to suit individual tastes.
DISK ORGANIZER II — NEW — SSO-OC
48K, Disk II, Apple ll/Apple II +
DO II is the fastest and friendliest utility available today for organizing files on an Apple II diskette. DO II provides the following functions: 1) TITLING in N(
mal. Inverse, Flashing, Lower case, and other characters normally not available, 2) CUSTOM REORDERING of the directory, 3) ALPHABETIZING, 4) DYNAM
DISPLAY of ALL filenames on a diskette (including deleted files), 5) RENAMING files with the same character options as TITLING, 6) UNDELETING,
DELETING, 8) PURGING deleted files, 9) LOCKING (all or some), 10) UNLOCKING (all or some), 1 1) USE of DOS sectors for increased data storage, and 12;
SIMULATED CATALOG to show the modified directory before it is written to the diskette. DO II is completely MENU DRIVEN and attains it's speed by altering
RAM version of the catalog. DO II uses a very powerful SMART KEY to automatically locate the next valid filename tor any specified disk operation. Compatit
with DOS 3.1 , 3.2, 3.2.1 , and 3.3 as well as MUSE DOS to allow manipulation of SUPER TEXT files! (Note: Updates available for $5.00 and original disketti
PASCAL LOWER CASE — NEW — SaS.OC
48K + , Disk II, Apple ll/Apple II + , Language System
This is the most recent commercially available LOWER CASE MOD for Pascal for the Apple II. It is the only currently available modification that is compatit
with both versions of Pascal (1 .0 and 1 .1 ). The Pascal version is automatically checked prior to UDdating system Apple, If you have any of the hardware low
case adapters you can now input the following characters directly from the keyboard: I '• ^ ■;; ~i _ and \ . This modification does NOT interfe
with any of the 'Control' character functions implemented by the Pascal environment and will 'undo' any alterations made by other commercially releasi
modifications,
QUICKLOADER SeS.OI
48K + , Disk II, Apple ll/Apple II + . . . (2 Disks)
If you find yourself doing the same things over and over -- QL will help you do it faster! QL is a unique disk that lets you load DOS, a language card (optionallj
and an application program of your choice extremely rapidly. QL boots as a 13 or 16 sector diskette and is easy to set up and use. To change the setup, y
merely load your Apple RAM with the new data and use the "RECONFIGURE" option of QL. The next time you boot your QL disk, it will quickly load yourni
setup (Language Card, DOS, Application program) into your Apple! QL can reduce the time to perform these functions by up to 80%! Now that you've re
this, you say "But I can already do all of that!" QL doesn't do anything new -• it just does it MORE CONVENIENTLY and FASTER! Try it, you'll like it
DISK RECOVERY ["THE SCANNER"] $30.01
48K+, Disk 11, Apple ll/Apple 11 +
This program is long overdue. You need no longer be concerned with the problem of physically damaged disks. Just as "Apple Pascal" provides a "B/
BLOCK SCAN", DISK RECOVERY will do a complete scan of your Apple diskettes' recording surface. Damaged areas will be "marked" as used in the di;
directory so that no attempts will be made to "WRITE" to a bad sector. The VTOC will be completely redone to reflect both the bad sectors and actual di:
usage. A complete report is generated advising the user of all corrections. A resulting "DISK MAP" is presented for your review. The greatest advantage
this program over the other versions is that it can be used on either NEWLY INITIALIZED DISKS or disks that ALREADY CONTAIN PROGRAMS as well as tl
SPEED of analysis. THE SCANNER is fully compatible with both 13 and 16 sector diskettes. This is a must for all Disk II owners!
ALSO AVAILABLE: SENSIBLE SOFTWARE, INC
SUPER DISK COPY III SSO.OO 6619 PERHAM DRIVE / W. BLOOMFIELD, MICHIGAN 480;
MULTI-DISK CATALDQ III SaB.OO 313 399 8877
THE NEW PROTECTOR SeSO.OQ
(Call or writ, lor Inloraalion) VISA and MASTERCARD WELCOME
LUNAR LANDER II 816.00 MicWgan ResWenls add 4% Sales Tax
^^—^ lUI A9B MMR OO '^^ "^'^ *' ■'* '"*'''' * handling for each item ordered.
32
MICRO - The 6502/6809 Journal
No. 38 - Ji
APPLE BONUS
Double Barrelled
Disassembler
Here is a short utility to make
creating disassembly listings
easier. This program not only
lists from starting to ending
addresses, but also formats the
listing into two columns for
easier reading and less paper
usage.
David L. Rosenberg
1706 Ridge Oak Place
Memphis Tennessee 38119
How many L's are tbere between $BDOO
and $BFFF? What seems at first to be a
ridiculous question actually points out
one of the few flaws in the Apple II' s
ROM Monitor. The problem arises
because the disassembler routine only
prints twenty lines at a time. This can
be a major annoyance if you are doing a
lot of long listings.
The program presented here attacks
this problem and foirmats the listing into
two columns to mioimize wasted paper
and make the disassembly easier to
follow. Once the program has been
BRUN the disassembly function is called
by typing "beginning address "."ending
address" (CTRL-Y) return. This se-
quence will disassemble the code from
the beginning address through the end-
ing address and prrat it in two column
per page format [see listing 1).
How Does it Work?
This program works by dividing the
first part of the object code into two
segments, each containing the same
number of instructions as there are lines
on a page. Then talcing one instruction
from each piece, it calls the Monitor
disassembly routine to print them on
the same line. Next the pointers to the
instructions are incremented and the
program loops to the disassembly por-
tion again. When all the instructions in
each segment are done, a form-feed is
' printed and the next portion of the code
is segmented, and the process is repeated
until the ending adclress is reached.
LINE* LOC
CODE
LINE
0002
0000
0003
0000
J ********A****'******Jk*****«**************«**********«*« 1
0004
0000
• ***
THIS
PROGRAM PRODUCES A TWO COLUMN DISASSEMBLY •**
0005
0000
***
LISTING USING PARTS OF THE MONITOR DISASSEMBLY *** |
0006
0000
***
ROUTINE. IT PRINTS
60 LINES TO THE PAGE AND ***
0007
0000
; ***
REQUIRES A 132 COLOMN PRINTER; HOWEVER THIS *»* |
0008
0000
; ***
CAN
BE MODIFIED IN
THE PROGRAM. ***
0009
0000
***
TO INVOKE THE DISASSEMBLER BRUN THE PROGRAM *** |
0010
0000
***
AND
THEN FROM MONITOR TYPE: ***
0011
0000
***
BEGINNING ADDRESS. ENDING ADDRESS (CTRL-T) *** 1
0012
0000
; ****************************************************** 1
0013
0000
1
0014
0000
CH
- 524
CURSOR HORIZONTAL POSN
0015
0000
LEN
- S2F
INSTRDCTION LENGTH
0016
0000
PC
- S3A
ADDRESS TO DISASSEMBLE
0017
0000
A2
- S3E
ENDING ADDRESS
0018
0000
A3
- S4
ADDRESS TO DISASSEMBLE
0019
0000
A4
- $4 2
WORK BYTE
0020
0000
A5
- S4 5
LINE COUNTER
0021
0000
VECTOR - $3F8
CTRL-Y VECTOR ADDRESS
0022
0000
NOVID
- 5579
SERIAL CARD NO VIDEO FLAG
0023
0000
HOOKS
- SAA5 3
, DOS 3.2.1 OOTPUT HOOK
0024
0000
[NSDS2 - SF88E
ROUTINE FOR INSTRDCTION LENGTH
0025
0000
PRINT
- $FDED
MONITOR COUT ROUTINE
0026
0000
PRl
- 5FD99
PART OF DISASSEMBLER (ROM)
0027
0000
PR2
- 5F889
PART OF DISASSEMBLER (ROM)
0028
0000
PR 3
- SP8D3
PART OP DISASSEMBLER (ROM)
0029
odoo
PR 4
- 5FE67
PART OF DISASSEMBLER (ROM)
0030
0000
*
• $800
0031
0800
0032
0800
*********************************************************** 1
0033
0800
**« THIS
ROUTINE SETS THE APPLE'S CTRL-Y VECTOR ADDRESS **
0034
0800
*** TO POINT TO THE STAI
IT OF THE DISASSEMBLER CODE **
0035
0800
•** IT IS
EXECUTED WHEN
THE PROGRAM IS BRUN *•
0036
0600
*********************************************************** 1
0037
0800
0038
0800
A94C 1
NIT
LDA
#$4C
OP CODE FOR JUMP
0039
0802
8DF803
SIA
VECTOR
STORE AT CTRL-Y VECTOR
0040
0805
A910
LDA
#<START
GET LOW BYTE OF ENTRY LOCATION
0041
0807
8DP903
STA
VECIOR+1
STORE AT VECTOR
0042
080A
A908
LDA
#>START
GET HI BYTE OF ENTRY LOCATION
0043
080C
BDFA03
STA
VECTOR+2
STORE AT VECTOR
0044
080F
60
RTS
0046
0810
0047
0810
*********************************************************** 1
0048
0810
***
START
OF DISASSEMBLER **
0049
0810
*********************************************************** 1
0050
0810
0051
0810
206208 S
TART
JSR
STHOOK ;
SET OUTPDT HOOKS FOR PRINTER
0052
0813
208708 H
LAIN
JSR
SETPC
SET PC TO A3
0053
0816
209908
JSR
SETA5
SET A5 TO f OF LINES PER PAGE
0054
0819
20E908
JSR
INITA3 ;
SET A3 TO START OF COLUMN 2
0055
081C
209E08 L
OOP
JSR
CMPCA2 ;
COMPARE PC TO END ADDRESS
0056
081F
20D608
JSR
OISASM i
DISASSEMBLE INSTRUCTION AT PC
0-05 7
0822
20B708
JSR
CMA3A2 ;
COMPARE A3 TO END ADDRESS
0058
0825
B012
BCS
L00P2 !
DON'T PRINT SECOND COLUMN IF >
0059
0827
20C408
JSR
STORPC ;
SAVE PC AT A4
0060
082A
208708
JSR
SETPC ;
SET PC TO A3
0061
082D
204808
JSR
TAB ;
SKIP TO MIDDLE OF PAGE
0062
0830
20D608
JSR
DISASM ;
DISASSEMBLE INSTRDCTION AT PC (-A3)
0063
0833
209008
JSR
SETA3 ;
SET A3 TO PC
0064
0836
20CD08
JSR
RSTRPC ;
SET PC TO A4
0065
0839
A90D L
00P2
LDA
#$0D
0066
083B
20EDFD
JSR
PRINT ;
PRINT CARRIAGE RETURN
0067
083E
C645
DEC
A5
DECREMENT LINE COUNTER
0068
0840
DODA
BNE
LOOP ;
IF NOT END OF PAGE THEN LOOP
0069
0842
205C08
JSR
FEE ED ;
• ADVANCE TO NEXT PAGE
0070
0845
401308
JMP
MAIN
0072
0848
A942 1
•AB
LDA
»$42
SET X-REG TO
0073
084A
38
SEC
66 - CURSOR POSITION
0074
084B
E524
SBC
CH
I.E. # OF SPACES TO PRINT
0075
084D
AA
TAX
TILL MIDDLE OF PAGE
0076
084E
FOOB ^
1
BEQ
TX
0077
0850
3009
BMI
TX
0078
0852
A9A0
LDA
#$A0
0079
0854
20EDFD
JSR
PRINT
PRINT SPACES TILL
0080
0857
CA
DEX
X-REG .
No. 38 -July 198,1
MICRO - The 6502/6809 Journal
33
II APPLE BONUS
The only problem I encountered was
that the Monitor disassembly routine
prints a carriage return as the first
character each time it is called. Ob-
viously this is not desirable after we go
to the trouble of positioning the printer
to the start of the second colimin. To
circumvent this the disassembler is
called in four separate pieces.
PRl is called to print the address in
the Program Counter ($3A,$3B) as four
ASCn bytes followed by a dash. PR2 gets
the length of the instruction pointed at
by PC, and forms an index into the
Monitor's op-code mnemonic table. PR3
actually prints the mnemonic along
with the appropriate address or hex
literal. At this point we must push a $01
onto the stack to indicate that this is the
last instruction to disassemble. PR4 in-
crements PC to point to the next in-
struction then pulls the top value from
the stack, decrements it by one and if
equal to zero does a return. Since PR4 is
jimiped to, this return will take us back
to the mainline where the program sets
up to disassemble the corresponding in-
struction from column two.
Before calling the Monitor dis-
assembler, PC must contain the address
of the instruction to be disassembled.
Since we are disassembling and printing
two non-sequential instructions on each
line, a large part of the program is con-
cerned with swapping instruction ad-
dresses in and out of PC. A4 ($42,$43J is
used as a work byte to store the colvmm
one address when the second colimin is
being disassembled. A3 ($40,$41) serves
a similar function when the first column
is being disassembled. A2 ($3B,$3F)
always contains the ending address of
the code to be disassembled.
The subroutine INrrA3 is interest-
ing because it calls a Monitor routine at
$F88E to return the length of an instruc-
tion. The whole purpose of the routine
is to find the address of the nth + 1 in-
struction, where n is the niunber of lines
per page. This is also the start of column
two, and so we want this address to
wind up in A3. To accomplish this we
will call INSDS2 n times and add the
resulting length to- the address at A3.
Note that the length returned is actually
one less than the actual instruction
length, and therefore, we must incre-
ment LEN before adding it to A3. Invalid
op-codes are not flagged, but are retum-
ed as one-byte length insttuctions.
0081 0858 4C4E08
JMP
Tl
0082 085B 60
IX
RTS
0083 085C
0084 085C A90C
FFEED
LDA
#SOC ■
; PRINT FORM FEED CHARACTER
0085 085E 20e:DFD
JSR
PRINT
0086 0861 60
RTS
0087 0862
0088 0862 AOOO
STHOOK LDY
#500
; SET THE DOS OUTPUT HOOK
0089 0864 A2C1
LDX
#$C1
; TO SCIOO SLOT 1
0090 0866 8E54AA
SIX
HOOKS+1
0091 0869 8C53AA
STY
HOOKS
0092 086C A98D
LDA
#58D
; PRINT CARRIAGE RETURN TO
0093 086E 20EDFD
JSR
PRINT
! INITIALIZE SERIAL CARD
0094 0871 A980
LDA
#$80
; SET SERIAL CARD TO
0095 0873 8D7905
SIA
NOVID
; NO VIDEO MODE
0096 0876 60
RTS
0097 0877
0098 0877 A900
UNHOOK
LDA
#S00
; RESET VIDEO MODE
0099 0879 AOFO
LDT
#$F0
; AND RESTORE OUTPUT
0100 087B A2FD
LDX
#$FD
; HOOKS TO SCREEN
0101 087D 8D7905
SIA
NOVID
0102 0880 8C53AA
STY
HOOKS
0103 0883 8E54AA
SIX
HOOKS+I
0104 0886 60
RTS
0105 0887
0106 0887 A540
SETPC
LDA
A3
; SET PC TO A3
0107 -0889 853A
STA
PC
0108 088B A541
LDA
A3+1
0109 088D 853B
SIA
PC + 1
0110 088F 60
RTS
0.111 0890
0U2 0890 A53A
SETA3
LDA
PC
; SET A3 TO PC
0113 0892 8540
STA
A3
0114 0894 A53B
LDA
PC+1
0115 0896 8541
STA
A3+1
0U6 0898 60
RIS
0117 0899
0118 0899 A93C
SETA5
LDA
#$3C
; INITIALIZE LINE COUNTER TO
0119 089B 8545
STA
A5
i 6 COUNTS DOWN
0120 089D 60
RTS
0121 089E
0123 089E
0124 089E A53B
CMPCA2
LDA
PC + 1
; COMPARE HI BYTE OF PC TO
0125 08A0 C53F
CMP
A2+1
; HI BYTE OF A2 (END ADDR)
0126 08A2 9012
BCC
C2
J < RETURN
0127 08A4 F005
BEQ
CI
; - COMPARE LOW BYTES
0128 08A6 68
PLA
; POP RETURN ADDRESS
0129 08A7 68
PLA
; OFF THE STACK
0130 08A8 407708
JMP
UNHOOK
; RESET HOOKS AND QUIT
0131 08AB A53A
CI
LDA
PC
; COMPARE LOW BYTES
0132 08AD C53E
CMP
A2
0133 08AF 9005
BCC
C2
; < RETURN
0134 08B1 68
PLA
; POP STACK
0135 08B2 68
PLA
0136 08B3 4C7708
JMP
UNHOOK
: RESET AND QUIT
0137 08B6 60
C2
RTS
0138 08B7
0139 08B7 A541
CMA3A2
LDA
A3+1
; COMPARE A3 AND A2
0140 08B9 C53F
CMP
A2 + 1
; RETURN WITH CARRY BIT
0141 08BB 9006
BCC
CMA2
; SET OR CLEAS TO
0142 08BD D004
BNE
CMA2
; INDICATE STATUS
0143 08BF A540
LDA
A3
0144 08C1 .C53E
CMP
A2
0145 08C3 60
CMA2
RTS
0146 08C4
0147 08C4 A53A
STORPC
LDA
PC
; SAVE CURRENT VALUE OF PC
0448 08C6 8542
STA
A4
; AT A4
0149 08C8 A53B
LDA
PC+1
0150 08CA 8543
STA
A4+1
0151 08CC 60
RTS
0152 08CD
0153 08CD A542
RSTRPC
LDA
A4
i RESTORE PC- FROM CURRENT
0154 08CF e53A
STA
PC
; VALUE OF A4
0155 08D1 AS43
LBA
A4+1
0156 08D3 853B
STA
PC+1
0157 0805 60
RTS
0158 08D6
0139 08D6 A63A
DISASM
LDX
PC
; DISASSEMBLE 1 INSTRTICTEON
0160 08DS A43B
LOY
PC + 1
! AT PC USING MONITOR
0161 OBDA 2099FD
JSR
PRl
; DISASSEMBLE ROUTINE IN
0162 08D0 2089F8
JSR
PR2
i FOUR PARTS
0163 08E0 20D3F8
JSR
PR3
0164 08E3 A901
LDA
#901
; SET COUNTER ON STACK FOR
0165 OSES 48
PHA
j NUMBER OF INSTRUCTIONS
0166 08t6 4C67FE
JMP
PR4
J ROUTINE SUPPLIES RTS
0167 08E9
34
MICRO - The •6502/6809 Journal
No. 38 -July
--S,
APPLE BONUS
Sifesift
0169
08E9
0170
08E9
0171
08E9
****••***»**«*«»*«****»**«******»*»•*»»*********** 1
0172
08E9
*** THIS
ROUTINE CALCULATES THE ADDRESS OF THE ***
0173
08E9
•** FIRST INSTRUCTION
IN COLUMN TWO *»*
0174
08E9
*********A*****************************A*AAA^A-^*** 1
0175
08E9
0176
08E9
0177
08E9
A23C
[N1TA3 LDX
#$3C
; NUMBER OF INSTRUCTIONS
017 8
08EB
AOOO
[NIT41 LDK
#S00
; SET INDEX POINTER
0179
08ED
8A
TXA
; SAVE NUMBER OF
0180
08EE
48
PHA
; INSTRUCTIONS ON STACK
0181
08EF
B140
LDA
(A3),Y
; GET OP CODE
0182
08F1
208EF8
JSR
INSDS2
; MONITOR ROUTINE FOR LENGTH
0183
08F4
E62F
INC
LEN
0184
08F6
A540
LDA
A3
; GET A3 AND
0185
08F8
18
CLC
; INCREMENT BY
0186
08F9
652F
ADC
LEN
; LENGTH OF INSTRUCTION
0187
08FB
8540
STA
A3
; SAVE in A3
0188
8FD
9002
BCC
INIT42
: mCREMENT HI BYTE
0189
08FF
E641
INC
A3+1
; IF NECESSARY
0190
0901
68
NIT42 PLA
J GET NUMBER OF INSTRUCTIONS
0191
0902
AA
TAX
0192
0903
CA
DEX
; SUBTRACT 1 '
0193
0904
DOES
BNE
INIT41
; LOOP IF NOT DONE
0194
0906
60
RTS
0195
0907
0196
0907
************************ [
0197
0907
** DAVID
L. ROSENBERG
**
0198
0907
»» 1706 RIDGE OAK PL.
**
0199
0907
** MEMPHIS TN. , 38138
**
0200
0907
************************ 1
0201
0907
0202
0907
.ENI
SOFTWABE AUTHORS!
for Apple. Atari, TRS-SO, NEC. Hitachi
Bt^erbund Software is looking for new authors to join its
international team of programmers- M you have a produ«|t for
the micro market, let us show you the advantages of working
•vhth our team of design, production and distribution
specialists. ■rj.\^tf«t>>.i.- "
Call or write for our free Authors Kit today or send us a
machine readable copy of your work for prompt review und^r^:
strictest confidence. \ ^^ ^^
ftrrtrJarbund SoftUJQT
"^'•' ■"'!'-! '. ■■.......-I ft « l l . »il» IIMM)JJJ,)JJ I >M)WIII<. l l^' ' 'f ' ,'^ ,,,
Box 3266, €ugene, Oregon 97403 (503) 343.-?0.2.4_-..,.
In order to end execution, routine
CMPCA2 compares the current value of
PC to the value of A2 (the end address).
If it is equal to, or greater than A2, we
pop the last return address from the
stack and jump to UNHOOK. This
effectively disconnects from the
mainline and resets the stack to the con-
dition it was at when the disassembler
was first invoked. Because the program
is called from monitor, the RTS in UN-
HOOK will result in a return to monitor.
Making it Work
This program was written for use
with an AIO serial card in slot #1 and a
Texas Instruments 810 printer. The
routine STHOOK sets the DOS output
hooks and disables the serial card's
video echo. If your interface is in a dif-
ferent slot, change the LDX instruction
at line 89. It is of the format Cn, where a
is the slot number. For printers with a
software-selectable line width this
would be the best place to include the
code for this function. The routine
UNHOOK is always the last one ex-
ecuted, and so is where you should reset
the line width.
The first instruction in the routine
TAB controls how far over (in print posi-
tions) the second colunm will start.
This can be changed to Vi of the line
width that you are using (i.e. $28 for an
80-column line). The number of lines
per page is set in two places, line 118
and line 177. It can be set to suit your
needs, but just be siue it is the same in
both places.
If your printer does not recognize
$0C as a form-feed character or does not
have a formfeed, the routine FFE ED
will have to be changed. Its only func-
tion is to cause the printer to skip to the
top of the next page.
Since the program uses standard
Apple output routines it can be used, as
is, with any printer card (serial or
parallel) that does not require a software
driver. If you use a print driver routine,
change the JSRs at lines 66, 79, 85 and
93 to go to your driver entry point. The
character to be printed will reside in the
Accumulator prior to these calls.
David L. Rosenberg is presently employed
as an analyst with the Management
Sciences department of Holiday Inns, Inc.,
and has been in the computer field for
eight years. He is a founding member of
the Apple Core of Memphis and has
contributed programs to its "diskette of
the month." In addition to working on
software and hardware projects for his
Apple, which he has owned for a year and
a half, he is actively pursuing a Masters
degree in Computer Science. MW»rt-
if
No. 38 -July 1981
MICRO - The 6502/6809 Journal
35
APPLE BONUS
FINANCIAL MANAGEMENT SYSTEM
A FUT. EMY TO OK ACCWNTIM SYSTEM USINEO FOR HOME AND lUSIIIESS
Enter an antirt month's CHECKING, CHARGE CARD, and CASH accounts in just
a tew minutes using personalized macro lists. INSTANT ERROR CORRECTION.
Audit all tiles by Code and Month with year-to-date totals.
* PERFECT FOR TAX ACCOUNTING
* SELF PROMPTING, ERROR AVOIDING ENTRY SYSTEM with 1 to 3 KEYSTROKE
ENTRIES and AUTOMATIC DATE, CODING and NUMBER SEQUENCING.
* Printer routines for listing disk files, balance reconcile, search, and audit
reports. Configure program to match almost ANY PRINTER.
' Enter your own ITEM and CODE MACROS, up to 100 each.
* Make specific and expanded searches employing complete use of macro lists
* «K with ROM APPLESOFT and DISK required, (printer optional)
*raiCE:S{9J6
FINANCIAL MANAGEMENT SYSTEM II
AU THE MOVE FEATURES PLUS *
* NEW BUDGET MANAGER - Plan, balance, and review your budget. Then
generate COMPLETE reports with summation for any 1 - 12 month period.
* SINGLE or DUAL DISK compatible. Configure program to either disk sytem.
'PRICE: nJ6
GROCERY LIST
A USEFUL HOUSEHOLO PROORAM OESMNEO TO ORSAMS SUPERMARKET SN0PPIH8
Shoppers will INSTANTLY be able to use this easy, self-prompting program.
Scan a file of up to 500 USER DEFINED ITEMS. Choose those needed with a
single key-stroke. Then print a shoppipg list ORGANIZED BY TABLE NUMBER,
SECTBN, or four letter code such as 'DAflY", "BAKE", or 'DELI".
■ 48K APPLE with disk and printer required, (APPLESOFT)
'PRICE: SI0J6
D R JARVIS COMPUTING
1039 CADIZ DR. - SIMI, CA 83066
PHONE (805) 526^)151
Check, VISA or MASTER CARD accepted. DEALER INQUIRIES INVITED
A STATISTICAL ANALYSIS
AND FILE MAINTENANCE SYSTEM
FOR THE APPLE IP" MICROCOMPUTER
As a Subset Language of P-STAT™ 78...
A-STAT™ 79 computes:
FREQUENCIES
Bi-VARIATE TABLES - CHI SQUARES
CORRELATION MATRICES
MULTIPLE REGRESSION
RESIDUALS
APPLE PLOT INTERFACE
APPLE FILE CABINET INTERFACE
FILE SORT
AQQREQATION
REPORT WRITING
COMPLETE TRANSFORMATION LANGUAGE
READS VISICALC FILES
A-STAT™ 79
Uses Standard DOS Text File and EXEC's
48K Version — All programs in Applesoftt"^
A-STAT™ 79 is avaiiable from:
ROSEN GRANDON ASSOCIATES
296 PETER GREEN ROAD
TOLLAND, CONNECTICUT 06084
(203) 875-3541
A-STAT™ 79 on Disk with 95-page manual... $125.00
Apple II 'm is a trademark of the Apple Computer Inc.
P-STAT tm 78 is a trademark of P-STAT Inc., Princeton, N.J,
A-STAT tm 79 Is copyrighted by Gary M. Qrandon, Ph.D
LISP
for the Apple II
Pegasys Systems' new P-LISP interpreter is a full im-
plementation of the well-known Artificial Intelli-
gence language. Written in machine code, this
powerful interpreter includes the following features:
• Over 55 functions implemented
• Extensive 45-page User Manual
• Full function trace
• Fast, efficient Garbage Collector
• Supplied wittn function editor and pretty-printer
• Runs in 32 or 48K Apple II or II -i- with disk
• ELIZA and other sample programs included
P-LISP is supplied on disk with User Manual for
$99.95. The manual is available separately for
$10.00. Please specify DOS 3.2 or 3.3.
Send all orders and inquiries to:
PEGASYS SYSTEMS <p
4005 Chestnut Street
Philadelphia, PA 19104
(215) 387-1500
Pennsylvania residents add 6% sales tax
Apple is a trademark of Apple Connputer. Inc.
Good software is no longer a myth.
THE PERFORMANCE SLICE
\eve\s
income '.jn ^q
2O0O
e(v-
wescan
W
piocess
l "^' invoice nT°'-'ull or n'
ACCOUNTS
PAYABLE COMING SOON!
* Complete your accounting systein with the soon to be releasee
A/P package, featuring automatic application of credit and debi
memos, open or closed item listing, full invoice aging, am
multiple reports that provide a complete transaction review.
•k Ykyr bMkkMpIng dMn't havi to bi i bulky. CMplinM pnem. Tt
SBCS Aetwiidiig Systm It dttlgMd fir flixlUllty and high pcrformim
wtth a eoit iftacUvniMs sura it btntflt ytur butlntnl
YOU NEED EXPERIENCE WORKING FOR YOl
* PaekaoM avallabl* at your local Appte' doalar.
;tV1 ALL BUSINESS COMPUTER SYSTEM'
T^OG n-cni/joori, Lincoln, WE G85 04 1402)467-137
MICRO - The 6502/6809 Journal
No. 38 - July 1
APPLE BONUS
M
Single-drive Disic
Baclc-Ups for Apple
This program allows the owner
of a single Disic II drive to bacl(
up a disl( without worrying about
the types of files residing on it.
While written for a 48K machine
using DOS 3.2, little difficulty
should be encountered In
converting to DOS 3.3 or to a
smaller size machine. Trades
containing DOS are not copied.
Steve Emmett
12816 Tewksbury Drive
Herndon, Virginia 22071
The idea for this siogle disk drive copy
routine was bom out of the frustration
encountered, and time spent, in doing
the many LOAD/SAVEs and BLOAD/
BSAVEs necessary to back up disk files.
Especially time consimiing, and in some
cases close to impossible, were the
lengthy text files thiat I encountered on
at least one purchased game disk.
The program to be described was the
RWTS routine inherent in DOS 3.2 and
well doomiented in The Do's and
Don't's of DOS 3.2. RWTS permits the
reading and/ or writing of any specified
track/sector combination on a disk. (For
an excellent description of the disk for-
mat, see pages 123-137 of the DOS 3.2
manual.)
Since I have but one Disk U drive,
the philosophy behind the program is to
minimize the number of times it is
necessary to remove and insert original/
backup disks. Of the 35 tracks on a disk,
the first 3 are devoted to the DOS 3.2
operating systems. I chose not to incor-
porate these 3 tracks in the duplication
process. There is no program impedi-
ment, however, to their incorporation if
desired. The remauiing 32 tracks were
divided into 4 groups, each containing 8
consecutive tracks. Table 1 lists the
' group number and the track numbers in
both decimal and hex. Each track is
composed of 13 sectors (numbered 0-12
No. 38 -July 1981
or $D-$C) with each sector containing
256 bytes. Thus, one track contains
3328 ($CFF) bytes, and each group con-
tains 26624 ($6800) bytes.
Since my Apple n is a 48K machine,
there is no problem in temporarily stor-
ing the 26K of data from each group in
RAM during disk backup. While I have
not tried it, I see no reason why appro-
priate changes in the program cannot be
made to allow a 32K machine to
accomplish backup using 8 track
groups. In addition, with the imminent
release of DOS 3.3 and the attending
change in sectors per track from 13 to
16, there is only a minimal change to
the program that must be made to allow
this program to work on 16 sectors per
track.
Piogiam Description
The program to accomplish the
backup is written in both BASIC and
machine language, with operator inter-
face provided by BASIC. The core of the
machine language program is the RWTS
routine. To use the RWTS routine, two
data blocks need to be defined: the
Device Characteristics Table (DCT) and
the Input/Output Block (lOB). As des-
cribed in the DOS 3.2 manual, the DCT
remains constant, while variables
within the lOB are subject to change,
depending upon whether a read or write
operation is being undertaken. Since
RWTS performs a single track/sector
operation each time it is called, the rest
of the machine language program is used
to increment RAM buffer pointers, track
and sector covmters, and to switch be-
tween read and write.
The machine language program
starts at $800, and to keep the calcula-
tion of RAM buffer pouters simple, it
was decided to start the buffer at $1000.
Since each sector of the disk contains
256 ($FF) bytes, it is necessary to incre-
ment only the high order byte of the buf-
fer pointer. If the low order byte is not
zero, the extra programming necessary
to implement buffer pointer calculation
is eliminated at the expense of the loss
of a little flexibility.
MICRO - The 6502/6809 Journal
Table 1: Track
Qrouping
Group Decimal
Hex
1 3-10
2 11-18
3 19-26
4 27-34
$3-$A
$B-$12
$13-$1A
$lB-$22
Prior to discussion of the machine
language program, several definitions
need to be made: Variable names for the
lOB and DCT follow the same scheme
as presented in the DOS 3.2 manual.
DIO is the number of original disk in-
serts that will occur. For a 48K machine,
it is 4. For a 32K machine it is 8. While
it is possible to do the backup in less
than 8 inserts on a 32K machine, the in-
creased bookkeeping necessary to covmt
tracks read is not considered worth the
effort.
As an example DIO = 6 could be
used, but then SVs tracks must be read
for each original insert. Or 5 occurrences
of 6 tracks per insert need to be read,
with a test to insure that the last insert
reads only 2 tracks. Either option is
possible, but I do not feel that the
increased overhead in the software to
account for these possibilities is
necessary.
The variable TRK is the nimaber of
tracks that will be read for each original
disk insert. For a 48K machine, it is 8.
For a 32K machine, it is 4. SCT is the
number of sectors per track that are to
be read. Under DOS 3.2 it is 13. With
DOS 3.3 it will be 16. As an aside, this is
the only change to the program that
must be made in order to run imder DOS
3.3 (with the possible exception of the
RWTS entry point). The increase in the
number of bytes read as a result of SCT
37
APPLE BONUS
*v*
being 16 (with TRK still being 8 and
DIO being 4) causes no data contention
between the program located at the low
side of the memory and the beginning of
the DOS at the high side of memory.
CTRK is simply the number of the
track currently being read or written.
CSCT is the current sector, and CDIO is
the cunent original disk insert count.
NTRK is a local pointer that increments
between 1 and 8, and is the current
number of tracks processed for the cur-
rent disk insert.
With these definitions in miad,
analysis of the machine language pro-
gram can begin. (Refer to the listing as
needed. )
Locations 800 through 80C (all loca-
tions are presxmied to be in hex notation
as are all variables) are set aside for con-
stant storage. 80D through 812 is set
aside as temporary storage of variables.
813 through 823 is the lOB, and 824
through 827 is the DCT. 828 is reserved
for the end of operation flag, and is
initially set to zero.
Once the constants have been
initialized, the RWTS routine is called.
After each call, a check is made to deter-
mine if 13 sectors have been read. If they
have not, CSCT is incremented. The
starting address for the next 256 bytes to
be delivered by RWTS is entered into the
lOB and RWTS is called again. When 13
sectors have been read, a check is made
to see if 8 tracks (NTRK) have been pro-
cessed. If they have not, CTRK and
NTRK are incremented, lOB is updated
with the new buffer starting address
and track/sector to be read, and RWTS
is again called. This process continues
until 8 tracks have been read. Once this
happens, the program then checks to
see if RWTS is in the read or write
mode.
If it is in the write mode, a check is
then made to see if the original disk has
been inserted 4 times. If it has, the pro-
gram branches to the END routine
which resets all temporary storage and
sets the end flag. A jump is then made
back to the BASIC calling routine. If 4
original disk insets have not been made
(and RWTS is in the write mode] then
lOB is updated by switching to read
mode, resetting the buffer to its default
to handle the next set of 8 tracks (that
the next sequential track has entered),
and resetting the sector and track tem-
porary covmters. The program then
jumps to the BASIC calling routine
where operator instructions are given.
Assembly Listing
0800
1
*
0800
2
* DISK COPY ROUTINE
0800
3
* BY fa'ltVE EmETT
0800
4
*
0800 04
5 DIO
BYT $04
CONSTANTS
0801 08
6 TRK
BYT $08
0802 OC
7 scr
BYT $0C
0803 13
8 ICBLO
BYT $13
0804 08
9 lOBHI
BYT $08
0805 24
10 DCTLO
BYT $24
0806 08
11 DCTHI
BYT $08
0807 60
12 CSTfiT
BYT $60
0808 01
13 CDRV
BYT $01
0809 60
14 PSLOT
BYT $60
080A 01
15 PDRV
BYT $01
080B 00
16 BUFLO
BYT $00
080C 10
17 BUFAB
BYT $10
080D
18
080D 03
19 CIKK
BYT $03
TEMPORARY
080E 00
20 CSCT
BYT $00
tfiURAGE
080F 01
21 CDIO
BYT $01
0810 10
22 Eunn
BYT $10
0811 01
23 mvK
BYT $01
0812 01
24 FWS
BYT $01
0813
25
0813 01
26 IBTOPE BYT $01
lOB
0814 60
27 IBSLOT BW $60
0815 01
28 IBDRVN BYT $01
0816 00
29 INVOL
BYT $00
0817 03
30 IBTRK
BYT $03
0818 00
31 IBSBCr BYT $00
0819 24
32 JSCCTL BYT $24
081A 08
33 TBnCTH BYT $08
081B 00
34 IBBUFL BYT $00
081C 10
35 TBHJPH BYT $10
081D 00
36
BYT $00
081E 00
37
BYT $00
081F 01
38 IBCMD
BYT $01
0820 00
39 IBSEKT BYT $00
0821 00
40 TWMDD BYT $00
0822 60
41 ICBPSN BYT $60
0823 01
42 ICSPEN BYT $01
0824 00
43
BYT $00
0825 01
44
BYT $01
•Dcrr
0826 EF
45
BYT $EF
■DCT
0827 re
46
BYT $06
•DCT
0828 00
47 ELfiG
BYT $00
•END FLAG
0829
48
0829 A908
49 PCALL
im #$08
082B A013
50
LDY- #$13
082D 20D903
51
JSR $03D9
•RWTS CALL
0830 AD0E08
52
IDA CSLT
0R33 CD0208
53
CMP SCT
•13 SECTORS?
0836 F015
54
BBQ FSBCT
0838 EE0E08
55
mC CSCT
083B EE1008
56
INC BUFHI
083E AD0E08
57
IXA (fitT
0841 8D1808
58
STA IBSBCT
0844 AD1008
59
LDA EUFHl
0847 8D1C08
60
STA IBBUFH
084A 4C2908
61
JMP RCALL
084D
62
084D AD0108
63 FSROr
IXA TRK
0850 CD1108
64
CMP NTRK
8 TRACKS?
0853 F023
65
BFV FTRK
0855 KR1108
66
INC NTRK
0858 EE0D08
67
INC CTRK
085B A900
68
LCA-#$00
085D 8D0E08
69
STA CSCT
ZERO SECTOR COUNT
0860 EE1008
70
DC BUFHI
0863 AD0E08
71
IXft CSCT
0866 8D1808
72
STA IBSECT
0869 AD0D08
73 '
LDR CTRK
38
MICRO - The 6502/6809 Journal
No. 38 - July
:;"£sa
APPLE BONUS
iContmued)
086C 8D1708
74
STA IBTRK
086F AD1008
75
UJA Bunn
0872 8D1C08
76
STA IBBUFH
0875 4C2908
77
JMP RCRLL
0878
78
;
0878 AD1208
79
iTKK
LDA RWS
087B C901
80
CMP #501
;IN READ MODE?
087D F03C
81
RRO RTW
087F AD0F08
82
Uft CDIO
0882 CDOOOe
83
CJIP DIO
r4 ORIGINAL INSERTS?
0885 F069
£14
RPD END
0887 EE0F08
85
INC CDIO
088A EE0D08
86
INC C1"RK
088D A900
87
LDA #500
088F 8D0E08
£18
STA CSCT
;ZERO SECTOR COUNT
0892 A901
89
IDA #$01
0894 8D1108
90
STA N-rKK
rREKRT RELATIVE TRACK COUNT
0897 AD0C08
91
LDA BUFAB
089A 8D10Ce
92
STA BUFHI
'
089D CE1208
93
DEC RWS
rRWS TO READ
08A0 AD0D08
94
LDA CTRK
08A3 8D1708
95
STA IBTRK
0aA6 AD0E08
96
LDA cscr
08A9 8D1808
97
STA IBSECr
08AC AD1008
98
LDA BUFHI
08AF 8D1C08
99
STA IBBUFH
08B2 AD1208
lOO
LDA RWS
08B5 8D1F08
101
STA IBCM)
08B8 4CEF08
102
JMP RTN
08BB
103
;
08BB A901
104
RTW
LDA #$01
08BD 8D1108
105
STA NTRK
08C0 A900
106
LDA #$00
08C2 8D0E08
107
STA CSCT
08C5 AD0D08
108
LDA CTRK
OflTR 38
109
SEC
08C9 E908
110
SBC #$08
;CTRK=CTRK-8
08CB 8D0IX)8
111
STA CTRK
08CE AD0C08
112
LDA BUFAB
08D1 8D1008
113
STA BUFHI
BASIC Listing
10 CALL
- 936
20 CALL :
2048
30 PRINT
: PRINT
: PRINT "
♦♦SINGLE DRIVE DISC COPY** " |
40 PRINT
: PRINT
50 PRINT
: PRINT
"THIS PROGRAM WILL
COPY TRACKS 3-34."
60 PRINT
"DOS
TRACKS (0-2) ARE NOT
COPIED."
70 PRINT
: PRINT
80 INPUT
"ENTER THE ORIGINAL
DISC AND HIT RETURN" ;R$ |
90 CALL
2089
100 IF PEEK
(2088) =15 THEN GOTO
140
110 IF PEEK
(2066) = 1 THEN
GOTO
BO
120 INPUT "ENTER
THE BACKUP
DISC AND HIT RETURN" ;R$ |
130 GOTO
90
140 POKE
2088
,0
150 PRINT : PRINT
"BACKUP COMPLETED
'
160 END
EXEC Fiie Listing
10
D$
_ II II
: REM
D$=CTRLD
20
PRINT D$:"
OPEN DISC COPY"
30
PRINT DS;"
WRITE
DISC COPY"
4
PRINT "INT
II
50
PRINT "BLOAD BDISCCOPY"
60
PRINT "LOMEM:2500"
70
PRINT "RUN
INTDISCOPY" 1
8
PRINT D$;"
CLOSE
DISC COPY"
90
END
If, on the other hand, RWTS is in
the read mode, the program then
decrements the value of CTRK by 8,
and resets lOB by switching from read
to write, entering the new value for
CTRK and resetting the buffer address
to its default value. The process en-
sures that the 8 tracks just read from
the original disk can now be written
onto the back-up disk. The program
then exits to the BASIC routine.
This entire process continues imtil
four original/backup disk insertions
have been made. Once the program
senses that it is in the write mode and
that CDIO = 4, it then branches to the
END routine. This routine then exits to
the BASIC program declaring that the
backup is complete. To back up another
disk, all that is necessary is to type
RUN.
To facilitate the use of these two
routines, the EXEC function of DOS is
used. EXEC allows the generation of a
text file that is then processed as a
series of DOS commands. In order to
run the disk copy routines, enter the
machine language program and BSAVE
BDISCCOPY, A$800, LI IF. Enter the
BASIC program and
SAVE INTDISCOPY.
Then generate a text file to be EXEC'ed
(see listing) . Note that the entry on line
40 depends upon whether yovir system
has the language card. If it does not,
remove this entry and prior to perform-
ing the disk copy, make certain that
your system is in Integer BASIC. To per-
form the disk backup procedure, simply
EXEC DISK COPY
and follow the instructions!
Steve Emmett is a physicist with 15 years
in the computer field. Major interests are
system security, simulation design and
CAI for very young children. He has an
Apple n with language card, one drive,
and is presently designing a symbolic
assembler/linker/loader.
micao
No. 38 -July 1981
MICRO - The 6502/6809 Journal
39
APPLE BONUS
Software for the Apple II and Apple II Plus
BENEATH APPLE DOS
A Technical Manual
By Don Worth and Pieter Lechner
Become an ex pert on the intricacies of Apple's DOS (Disk Operating System). BENEATH
APPLE DOS is the perfect companion to Apple's DOS 3.3 Manual. Containing eight
chapters, three appendices, a glossary, an index, and over 160 pages, this manual will
serve to completely fill in the many gaps left by Apple's DOS 3.3 Manual. Written for
Apple users with DOS 3.3, 3.2 or earlier versions, any Apple disk user would welcome
having this carefully written manual at his fingertips.
LEARN ...
• How DOS 3.3 differs from other DOS versions.
• How disks are protected.
• How to reconstruct a damaged diskette CATALOG.
• How tracks are formatted.
• How to use the disk directly, without DOS.
• How to call DOS's file manager.
• How every routine in DOS works.
• How to customize DOS to your needs.
• How to overcome DISK I/O ERRORS.
• About the "secret" file types — S and R.
INCLUDES . . .
• Large quantities of excellent diagrams and tables.
• Source listings of useful disk utilies.
• Glossary of over 150 technical terms.
• Exhaustive description of DOS program logic.
• Handy reference card.
• Useful patches to DOS.
• Many programming examples.
Book - tl9.95
CROSS-REF by Jim Aalto
Applesoft programmers will be delighted to have this cross reference utility program in
their 'tool kit' of software aids. What can CROSS-REF do to speed and facilitate your
Applesoft program development? Consider these functions:
VARIABLE CROSS REFERENCE LINE CROSS REFERENCE
FIND VARIABLE FIND LINE NUMBER
REPUCE VARIABLE VARIABLE ONLY LISTING
LINE ONLY LISTING
Features that make CROSS-REF easy to use include:
• Written in machine language, occupies less than 3K.
• Resides passively in memory while DOS or Applesoft is active.
• Can be loaded with your Applesoft program already resident
• Very fast — a VARIABLE CROSS REFERENCE for a I6K Applesoft program can start
printing in 5 seconds.
• Contains printer format controls and headers for documentation.
• Prints English language error messages.
Cassette - $22.95 Diskette - $24.95
L
i
N
K
R
LINKER by Don Worth.
Turn your Apple II or Apple II Plus into a powerful and productive
software development machine with this superb linking loader/editor
package. LINKER does the following and much more:
• Dynamically loads and relocates suitably prepared machine
language programs anywhere in RAM.
• Combines a main program with subroutines. You can assemble a
subroutine once and then use It with as many main programs as you
wish.
• Produces a map of all loaded routines, giving their location and the
total length of the resulting module.
• Contains a library of subroutines including binary multiplication and
division, print text strings, delay, tone generator, and random
number generator.
Linker works with virtually any assembler for the Apple II. Requires 32K
of RAM and one disk drive.
Diskette - $49.95
Manual Only - $19.95
Cassette
FASTGAMMON" By Bob Christiansen.
Sound, hi res, color, and musical cartoons have
helped make this the most popular backgammon
playing game for the Apple II. But don't let these
entertaining features fool you — FASTGAMMON
plays serious backgammon. Runs on any Apple II
with at least 24K of RAM.
$19.95 Diskette - $24.95
METEOROIDS IN SPACE"
By Bruce Wallace
We have taken our popular space
game, formerly called Asteroids in
Space, and made some important im-
provements. To accent these improve-
ments we have given it a new name —
METEOROIDS IN SPACE. Your space
ship travels through a shower of
deadly meteoroids. It your ship is hit, it
will be destroyed, so you use your laser
gun to blast the meteoroids. Big
meteoroids shatter into smaller
meteoroids when hit and the smaller
ones are usually faster and just as
deadly. From time to time you will en-
counter an alien space ship whose
mission is to destroy you, so you'd
better destroy it first All the action is
displayed in fast smooth, high resolu-
tion graphics, accompanied by sound effects. You now can control your ship usin
of two options — the Apple game paddles or the keyboard. One of the game p
buttons controls the laser fire. In METEOROIDS IN SPACE, the spaceship's ve
gradually decreases unless more thrust is applied, adding an element of control
new to this version is a hyperspace feature — translate instantly to another spot
galaxy. The game is over when five of your ships have been destroyed. An addi
ship is added for every 10,000 points you score. Runs on any Apple II with at leas
of RAM and one disk drive.
Diskette - $19.95
ASTROAPPLE" by Bob Male.
Your Apple computer becomes your astrologer,
generating horoscopes and forecasts based on the
computed positions of the heavenly bodies. This
program offers a deli|htful and stimulating way to
entertain friends. ASTROAPPLE produces natal
horoscopes (birth charts) for each person based
on his or her birth data. Any two people may be
compared for physical, emotional, and rntellectual
compatibility. The program is written in Applesoft
BAS(C with machine language subroutines. It
requires either RAM or ROM Applesoft and at least
32K of memory.
Cassette - $14.95 Diskette - $19.95
FRACAS" by Stuart Smith.
A fantastic adventure game like no other! Up to
P^ players can participate in FRACAS at the same
iprjy&y. Journey in the land of FAROPH, searching for hi
s^^T^ treasure while warding off all sorts of unfriendly
^^'j]' dangerous creatures. You and your friends can cor
with each other or you can join forces and gang up o
monsters. Your location is presented graphically and s
effects enliven the battles. Save your adventure on di;
or cassette and continue it at some other time. Both in
BASIC and Applesoft versions included. Requires at
32K of RAM.
Cassette - $19.95 Diskette - $24.95
BATTLESHIP COMMANDER" by Erik Kilk and Matthew Jew.
A game of strategy. You and the computer each start out by positioning hve shi
different sizes on a ten by ten grid. Then the shooting starts. Place your volleys skil
— a combination of logic and luck are required to beat the computer. Cartoons :
the ships sinking and announce the winner. Sound effects and flashing lights aisc
to the enjoyment of the game. Both Applesoft and integer BASIC versions are incli
Requires at least 32K of RAM.
Cassette - $14.95 Diskette - $19.95
Also by Don Worttt . . .
BENEATH APPLE MANOR - Adventure. Uses Integer BASIC.
Cassette - $14.95 Diskette - $19.95
BABBLE - Fun with words, sound, and graphics.
Cassette - $19.95 Diskette - $24.95
QUTiLrry softwtirg
6660 Reseda Blvd., Suite 105, Reseda, CA 91335
(213) 344^i599
Now exclusive distributors for products from The Software Factory, Newhall, California
'Apple II and Apple II Plus are trademarks of Apple Computer, Inc.
WHERE TO on IT: Call us at (213) 344-6599 for the name of the Quality Soft
dealer nearest you. If necessary you may order directly from us. Mastercarc
Visa cardholders may place orders by telephone. Or mail your check or bani
number to Quality Software, 6660 Reseda Blvd., Suite 105, Reseda, CA 91
California residents add 6% sales tax. SHIPPING CHARGES: Within North Am
orders must include $1.50 for first class shipping and handling. Outside f
America the charge for airmail shipping and handling is $5.00. Pay in
currency.
40
MICRO - The 6502/6809 Journal
No. 38-Ji
t
APPLE BONUS
'\
Enhanced Input Routine
i>
Getting data into a program is
one of the most important
aspects of program
development. This routine for
the Appie does it aii.
Bruce A. Robertson
1 Van hurst Place
Ottawa, Ontario
Canada, K1V 9Z7
In prof essionally-vnitten software, great
care is taken to provide the program user
with as much flexability as possible, as
well as making tie program easy to
maintain. By having all input controlled
by a single routine, many lines of code
may be eliminated, input can be stan-
dardized, program control is more
modular and in most cases the user of an
interactive system, is presented with a
cleaner, more readable display.
The input routine shown in listing 1
is an adaptation (in Applesoft) of an La-
put routine that vdll accomplish all of
the above. Althouj^h it appears large at
first glance, once the remarks are
removed, it is actually quite small and
very manageable. The large number of
remarks were included to make the
routine easy to understand.
This routine uses standard BASIC
terms and could be keyed into any
system using a variety of versions of
BASIC.
From the User's Viewpoint
Anyone using a program containing
this input routine has considerable
power over program execution. For ex-
ample, programs may be run to obtain
intermediate results. The user can then
back up and re-insert new data based on
the results previously obtained. In a pro-
gram that has a repetitive sequence
where many of the prompts are
repeated, only one actual input, contain-
ing the responses to all the questions,
needs to be made.
No. 38 -July 1981
To accomplish this, two characters
are reserved for use by the input routine.
The slash, "/", is used as a delimiter to
separate multiple answers to a prompt.
The question mark "?", when it is die
first character, is used as a signal to back
up to the previous prompt. A carriage
return is interpreted as acceptance of the
prompt default.
To illustrate, consider the following
prompt sequence:
WHAT IS YOUR NAME
(END PROGRAM)?
WHAT IS YOUR AGE (25)?
WHAT IS YOUR PHONE
NUMBER (NONE)?
These prompts could be entered one at a
time, or using the power of the input
routine as:
WHAT IS YOUR NAME (END
PROGRAM)? JOHN SMITH/
22/555-4652
The program would then continue and
print out the rest of the display as:
WHAT IS YOUR AGE (25)?22
WHAT IS YOUR PHONE
NUMBER (NONE)?555-4652
If a list of names, ages and telephone
numbers are being entered, a great deal
of time could be saved by making only
one entry. If the entries are being made
one at a time, a mistake ui the name,
that is not discovered vmtil the age is
about to be entered, may be corrected by
typing a "?" in response to the age
prompt:
WHAT IS YOUR AGE (25)??
Whereupon the program would back up
on the screen as well as in the program
logic to the prompt:
WHAT IS YOUR NAME
(END PROGRAM)? JOHN
SMITH
with the cursor positioned on the "J" in
"JOHN". The correct response is now
typed in and the program is continued.
MICRO - The 6502/6809 Journal
The user has one other command
that is recognized by the input routine
— the word "QUIT." If the word
"QUIT" is entered as the sole response
to any prompt, then program execution
is immediately transferred to whatever
closing routine is provided by the pro-
gram, and an orderly exit is completed.
To the user this could mean a quick
chainiiig back to a controlling program
or menu.
The input routine also allows the
sensing of default inputs and provides an
easy method for the user to enter often-
used responses. As can be seen from the
prompts above, a default answer is pro-
vided for each of the questions. These
defaults are chosen to provide the most-
used or least-harmful responses to each
input request. This allows the user to
progress through the program by simply
pressing the carriage return for most
inputs.
How It Works
Although there are many remarks in
the listing to explain the operation of
the routine, the following line-by-line
explanation will clear any doubts and
will attempt to highlight the reasoning
behind the code. Line 905 — BACKUP
is the variable used by the mainline of
the prograni to indicate whether or not
it is necessary to back up through the
program. DISPLAY is used by the input
routine to decide if it is necessary to
print the present response on the ter-
minal. If a multiple entry response is
given, the second and later portion of
the response must be printed when the
appropriate prompt is printed. However,
since they will not be keyed in from the
keyboard and echoed on the screen they
must be printed by the program.
DISPLAY gives the signal to the routine
to print the response. ALPHA,
NUMERIC and DFAULT are flags used
to determine if the current response is
alphabetic, numeric, or acceptance of
the default.
41
APPLE BONUS
The next command in line 905 deter-
mines if the actual INPUT command
should be skipped by testing to see if
anything is left over from previous in-
put. If there is something left over, it
equates the input variable, ANSWERS,
to everything that is left over. Provided
the IF condition test is true, the GOTO
statement is executed and the INPUT
command is skipped.
Line 910 accepts the program input
into ANSWERS and resets the DISPLAY
variable to indicate that it is not
necessary to print the response on the
screen. Line 915 takes care of problems
caused by successive default entries by
placing a null character at the start of
the input string. At line 920 the length
of the input is fotmd, and then the first
character of the input is picked off and
tested to see if it is the back-up signal
character. The character tested for is the
question mark "?". This was chosen
because it is on the same key as the
other special character that is used by
the input routine, and because it is very
unlikely that it would be the first
character in any input string. It is coded
as a CHR$(631 rather than as "?" only to
show that any character may be used,
including control characters.
If the back up signal is detected, the
input statement and any pending
responses are zeroed to eliininate pos-
sible errors when the input routine is
next entered. Since imder this condi-
tion, no further processing is required,
an immediate RETURN to the mainline
of the program is executed. Line 925
checks to ascertain if the cunent
response is a multiple entry input. To do
this, an in-string search is done fox the
input delimiter, the slash — "/". The
slash is an arbitrary choice and could be
any character desired, except the colon
and the comma, which axe used by the
Apple monitor. The search is carried out
for the full length of the response.
The search is conducted in a loop
and only the first delimiter is of interest.
If the character being examined is not a
delimiter, it is of no interest and the
next character is taken. Successive
GOSUBs to the input routine will
search for successive delimiters in any
multiple entry input.
At line 930, if a delimiter has been
foxmd, the input string is split into the
portion ahead of the delimiter, and
everything afterwards. The left part con-
tains the current answer and the right
part is the remainder of the response. It
is only necessary to find one answer at a
time, so a GOTO is executed to exit
Listing 1
900
905
910
9i:
920
930
93E
940
94S
950
955
960
96S
970
REM »** INPUT ROUTINE ***
BACKUP = o;dfault = o:alpha = o:numeric = c
ilF OVERi <> ■■ THEN ANSUER$ = OVER*
IDISPLAY = 1
!60T0 915
!rem is anything left over from previous input"?
skip input if anything left over
input answer* ! ihsplay =
! answer* = answer* + chrt(o)
;rem get input and turn off hisplay flag,
IF LEFT«<ANSWER«fl) = "/" THEN ANSWER* = CHRt(O) + ANSUERi
:rem add nulls to handle problems created by
slasrt being first or last character
lgth = len( answer*)
:if left«(answer*>n = chr*(63> then backup = 1
: ANSWER* = ■■ i OVER* = '•
: RETURN
IREM FIND LENGTH OF INPUT
CHECK IF BACKUP CHARACTER ENTERED
CHR*.(63) IS A QUESTION MARK
ZERO INPUT STRINGS
FOR I = 1 TO LGTH
!IF MID* (ANSWER*. I. 1) <> "/" THEN GOTO 935
!REM HOU MANY CHARACTERS TO CHECK
SEARCH FOR INPUT DELIMITER
REPLY* = LEFT*CANSWER*.I-1)
:OVER* = RIGHT*<ANSWER*fLGTH-I)
JGOTO 945
;rem pick off first answer in string
save rest of input string
stop looking for delimiter
NEXT I
!REM FALLS THROUGH IF NO DELIMITER FOUND
REPLY* = ANSWER*
••OVER* = ■■
:REM transfer input to routine OUTPUT STRING
INSURE NOTHING LEFT OVER
IF DISPLAY THEN PRINT " '■* "! REPLY*
:REM IF MULTIPLE INPUTS THEN PRINT
PRESENT INPUT ON SCREEN
IF REPLY* = "QUIT" + CHR*<Oi THEN GOTO j^'oOO
'.REM PROVIDE QUICK EXIT FROM PROGRAM
LINE 32000 IS START OF CLOSING SEOUEfNCE.:
SMALL* = LEFT*(REPLY«.l 1
:IF SMALL* = CHR*iO) THFN OF AUI., r = 1
;REM pick OFF FIRST LETTER' OF INPUT
IF NULL STRING THEN INPUT IS DEFAULT
IF ASC(SMALL*) > 64 AND ASCCSMALL*) < 91 THEN ALPHA = 1
:REM CHECK IF FIRST CHARACTER ALPHABETIC
FOR MINI - EDIT
IF ASC( SMALL*) > 47 AND ASC( SMALL*) < 58 THEN NUMERIC = 1
:REM CHECK IF FIRST CHARACTER NUMERIC
FOR MINI - EDIT
RETURN
from the search. At line 940, if a
delimiter has not been found, the pro-
gram completes the loop and transfers
the entire input to the routine output
string. The string holding anything left
over is zeroed because the last response
of a multiple entry input would fall
through to line 940, and OVER$ would
still contain this last response on the
next entry to the input routine.
Line 945 causes the current ans
of a multiple entry input to be print©
response to a prompt, as if an INF
command had actually been execu:
This is necessary because line 91(
skipped on subsequent entries to the
put routine if more than one answe
detected. It is important to note that
variable DISPLAY need not be equa
to anything. Applesoft, in a conditio
42
MICRO - The 6502/6809 Journal
No. 38 - July 1
m
...jiaS
dijffir^:
gS
i^^M
APPLE BONUS
j^±.'i^^
Listing 2
*** EXAMPLE OF USAGE ***
90
HOME :rem clear screen
too
y TAB (10): PR I NT -WHAT IS YOUR NAME <END PROGRAM> ■»
:G0SUB 900
:REM ESTABLISH SCREEN POSITION
PRINT PROMPT AND GET INPUT
:L10
IF. BACKUP OR BFAULT THEN GOTO 32000
:REM 32000 IS START OF CLOSING SEQUENCE
THIS BACKS OUT THE TOP OF THE PROGRAM
120
if alpha = then over* = ■ '
:goto 100
:rem mini edit - ensure input alphabetic
130
NAME* = reply*
:rem save input
140
vtab(12):print -what is your age <25> ■;
tGOSUB 900
tREM establish SCREEN POSITION
PRINT PROMPT AND GET INPUT
150
IF BACKUP THEN GOTO 100
tREH BACK UP
160
IF DFAULT THEN AGE = 25
!GOTO 190
;REM DEFAULT VALUE
170
IF NOT NUMERIC THEN OVER* = "■
tGOTO 140
tREM MINI EDIT - CHECK IF INPUT NUMERIC
ISO
AGE = VAL<REPLY*)
•.REM SAVE AGE
190
.... ETC.
32000
32010
32020
32030
VTAE(22):PRINT "ARE YOU FINISHED <NO>'J
iGOSUB 900
IF BACKUP OR DFAULT GOTO 90
IF NOT ALPHA GOTO 32000
IF SMALL* <> "Y" GOTO 32000
32100
H0ME:VTAB(12) {HTAB(12)
: PR I NT "THANK YOU AND GOODBYE"
test, need only determine if the condi-
tion is true. In the absence of an equal
sign the test is true if the variable has
any value other than zero.
^ At line 950 the word "QUIT" pro-
vides a shortcut through the program to
the closing sequence, which is very
useful when testing; or maintaining a
program. It can also be used, if the clos-
ing sequence is properly coded, to loop
to the start of the program, rather than
going through a long series of prompts or
exiting from the program run.
At line 955, SMALL$ provides a one-
character output from the routine that is
most useful when "yes" or "no"
responses are possible, or when a single
character is sufficient to distinguish be-
tween a series of inputs. This string is
tested to determine whether the current
answer is a default response. At lines
960,965 a miniscule edit is performed to
determine if the first character in the
current answer is alphabetic or nimieric.
The appropriate flag is set for use by the
program mainline. Any small edit can
be carried out in the input routine with
the edit either hard-coded as shown or
passed to the routine as a variable.
However, editing of a more substantial
nature should be placed in a separate
routine.
How to Use It
Listing 2 shows the type of coding
necessary to effectively use the input
routine. Each mainline input should re-
quest only one input, provide a default,
test for the backup flag and the default
flag, and save any input or default in the
appropriate variable. The input routine
provides six outputs: REPLY$, SMALL$,
BACKUP, ALPHA, NFUMERIC and
DFAULT. Use of these outputs in an
effective maimer will provide positive
program control and will benefit both
user and programmer. Screen addressing
should be used for all prompts to allow
for over-printing of prompts when back-
ing up so as not to clutter up the display
with repeated prompts.
The Apple computer does not allow
use of the ELSE statement, so each test
of a flag must be on a separate,
numbered line. On systems where the
ELSE statement is allowed, all flag tests
can be in case structure on the same
munbered line as the prompt.
Summaiy
The INPUT ROUTINE is an ex-
tremely useful addition to any
subroutine library and its use will cer-
tainly improve program control in new
program development. It is self-
contained and can be plugged into
existing code with a minimum of effort.
Programs using this routine will in-
crease their through-put and improve
user acceptance. A bit of practice will
soon show you the power and limita-
tions that can be expected using this
routine. Good programming!
Bruce A. Robertson is an electronic
specialist with over 20 years experience.
He has been programming since 1977 and
is currently employed by the Department
of National Defense in the Directorate of
Computer Applications Development as an
applications programmer. He has owned
an Apple n Plus computer for over a year.
iMCftO
No. 38 -July 1981
MICRO - The 6502/6809 Journal
43
' » »
DUAL DOS
IN
ROM
FOR APPLE ][
SWITCH FROM ONE DOS (3.2 or 3.3) TO THE OTHER
WITHOUT BOOTING
DUAL DOS ROMS - No gadgets or unsightly switches hanging from your disl( controller, no software to run, no memory space used to store the other DOS, does not need the use of the
3.2 Proms (for those of you who purchased a disk drive with 3.3 DOS). Utilizes the standard 3.2.1 and 3.3 DOS, no special software (Muffin/Demuffin) to move your programs to and
from 13 and 16 sector disks, no system pointers are changed, and is unaffected by any DOS commands. This invaluable utility is contained in two ROMs, which when plugged into MC's
Romplus* or the Andromeda ROMBoard', will be permanently imbedded in your Apple's memory and waiting (or instant access. The length of time it takes the Apple to perform a
carriage return is about how fast it takes to switch from one DOS to the other. Both ROMs have their own intelligence which allows one ROM to find the other, in order for them to toggle
between either DOS. Either ROM can be initialized first. If the 3.2 ROM is initialized first the Applesoft Ampersand command can be used to toggle or flip from one DOS to the other. On
the otherhand, if you wish to preserve the existing Ampersand command vectors, the 3.3 ROM can be initialized first. The toggle or flip between DOS can then be accomplished by a
simple CALL command from either Basic or Direct from the Monitor. Any program that is in memory will not be affected by the Hip between DOS. The flexibility of toggling either DOS
lends itself very easily to be done directly from within your own programs. Diskettes can be initialized 1rom either DOS and 13 sector disks will have the faster INIT routine as part of its
DOS. DUAL DOS ROMS are not recommended for use with disk drives that are configured with 3.2 Proms. Will operate with FP, INT, or LC and requires 48K, DOS 3.3, and MCs
Romplus or Andromeda's ROMBoard. (two ROM Set) S4S,a5
OTHEI ROMS AVMUBLE: Al ROMS are compatible with MC'S Romplus or Andromeda's ROM Board.)
FP RENtMBER/MBHiE ROM -Apple Computer's infamous renumber program S3B.SB
BASICS ROM ■ Win boot standard, special, and dedicated 1 3 sector disks S3B.SB
FPEnTROM-Globalsearcli, change, and remove. (Works jointly with RLE) $3S.SS
COMMiWD ROM -Catalog Command Menu and Disk Map $3B.9B
DISK COPY/ SPACE ROM -Duplicates 1 3 or 1 6 Sector Disks S3B.9B
'YOUR' PLE ROM -Your Customized Program Line Editor In Firmware S4S.9B
ORDER 3 OR MORE (Dual DOS coaiito is mm) AND DQNKT 10% Of YOUR TOTAL ORDER. (Clnck « H.O.) Visa or MasttrCanl Accepted
Soft CTRL Systems, box 599, west milford.nj o748o
•REGISTERED TRADEMARK
ALL HRMWAHE IS COPYRIGHTED
I
DOUBLE DOS PLUS
for Apple Computers
DOUBLE DOS Plus— a piggyback board that plugs into the
disk-controller card so that you can switch select between
DOS 3.2 and DOS 3.3. Works with the language systenn elimi-
nating the need in many cases to boot the BASICs disk. Also
eliminates the chore of converting all of your 3.2 disks to 3.3
WHY IS DOUBLE DOS PLus better?
• Nothing needs to be soldered, just plug in and go.
• Since all four ROMS are used, all software will work,
even early 3.1 DOS.
• Because the ROMS fit on the back of the board, it has
the thinnest configuration allowing full use of slot #7
• One set of ROMS is powered up at a time, thus saving
power.
• Full 90-day warranty from TYMAC.
NOTE: APPLE is a registered trademark of APPLE Computer, Inc., Cupertino, CA.
DOUBLE DOS Plus requires APPLE DOS ROMS
OTHER UNIQUE PRODUCTS FROM MICRO-WARE DISTRIBUTING INC
THE APPLE CARD— Two sided 100% plastic reference card for the Apple c(
Loaded with information of interest to all Apple owners
PARALLEL PRINTER CARD— PPC-100— A Universal Centronics type paralie
board complete with cable and connector. This unique board allows you to turn oi
the high bit so that you can access additional features in many printers Use with
ANADEX, STARWRITER, NEC, SANDERS, OKI, and other with standard Ce
configuration
'1';:; ^^ i)
THE DOUBLE BOOTER ROM— Plugs into the empty D8 Socket on the AppI
board or the Integer ROM Card to provide a 1 3 sector boot without using the BA!
DouBleBooler may also be used in the MOUNTAIN HARDWARE ROM PLUS bi
chip will not work in a plus machine unless it contains an Integer board or a I
board ,
DISK STIX— Contains 10 dozen diskette labels with either 3.3 or 3.2 designati
for program names and type also
*********** * SOFTWARE* **********i
SUPER SEA WAR— Hires battleship type simulation
ULTIMATE XFER— A telephone software transfer program, uses DC Hay<
micromodem
ROAD RALLYE — Hires driving game with 5 different full screen tracks
MISSILE CHALLENGER— Hires arcade type game where you defend your c
falling missiles. 8 levels & writes name & high score to disk
SUPER PIX— Hires screen dump for the EPSOf^ MX-&Ci. inverse or normal, large
page graphics in 2 orientations. Needs Tymac PPC-l6b Printer board or we wil
your EPSON board for $25
GRAPH-FIT — A hires graphing program that produces bar charts, pie charts
graphs. Has auto scaling tea*ure too
MICRO-WARE
DISTRIBUTING INC.
P.O. BOX 113
POMPTON PLAINS, N.J. 07444
201-839-3478
DEALER INQUIRIES INVITED!!
44
MICRO - The 6502/6809 Journal
No. 38 -July
APPLE BONUS
'>
Binary File Parameter List
w
This utility program will list the
address and length, In both hex
and decimal, of all binary files
on a given disk. It will also
calculate the number of free
sectors available on the disk.
The utility works equally well
with both DOS 3.2 and DOS 3.3.
Clyde R. Camp
3518 Wildflower Lane
Johnson City, Tennessee 37601
Although Apple DOS 3.2 is a relatively
powerful Disk Operating System, it is
geared primarily towards BASIC file
management, and is somewhat short on
capabilities for machine language or
inary file management. Among other
things, it is left to the user to remember
the address and length of a binary file
(BFILE) when using BSAVE and
BLOAD.
This can be very siggravating when it
becomes necessary to copy or relocate a
BFILE, or to know where it was originally
located, or what its length is. Although
one can always BLOAD the file and then
PEEK into page zero RAM to find the
start and length pariimeters, this must
be done manually, in immediate mode.
Any program to do the PEEKing could be
inadvertently overwritten by the
BLOAD operation, and to blindly
BLOAD one of these liiles could wipe out
existing programs, alter data bases, or
even zap DOS itself. Even though an ar-
bitrary starting address can be specified,
an unknown length is still likely to
cause trouble by overwriting needed
portions of RAM.
The program listed here (Usting 1]
avoids all of these problems by utilizing
the DOS RWTS subroutine to search for
and list all BFILE parameters [name, ad-
dress, length) on a gi.ven disk. (In addi-
ction, it calculates the total number of
^remaining free sectors on the disk,
which is a very usefuil piece of informa-
tion.) It accomplishes this by searching
the disk directory for binary files. Once
a BFILE is located, the first four bytes of
the first sector of the file are examined.
These bytes contain the start and length
parameters as follows:
Byte Least significant byte of address
Byte 1 Most significant byte of address
Byte 2 Least significant byte of length
Byte 3 Most si^ificant byte of length
Since at most, only one sector of the
BFILE need be loaded (the first sector),
only a known amoimt of buffer storage
is needed (256 bytes to be exact) and the
hazard of overwrite is prevented.
The program was written for an
Apple n wiA 48K and Applesoft firm-
ware, but it should run on any DOS
system in which the user can utilize
page one Hi-Res graphics. This is
because the machine language routines
involved reside in that memory area.
Please note that most GOSUB and
GOTO statements refer to REMs for
documentation purposes. So, when
entering the program, be sure to include
at least these REM statements to pre-
vent a lot of MISSING STATEMENT
error messages.
10
20
30
Listing 1
REH ***BFILE PARAMETER LIST***
GOSUB 960
TEXT : HCME : PRINT "THIS PROGRAM WILL SEARCH A GIVEN DISC FOR ALL
BINARY FILES, GIVING THE FIRST 13 LETTERS OF THE FILE NAME FOLLCWE
D BY THE FILE START ADDRESS AND FILE LENGTH IN BOTH HEX AND (DECIMAL)"
PRINT : PRINT "THE NUMBER OF FREE SECTORS ON THE DISC WILL ALSO BE
CALCULATED"
INVERSE : FLASH : VTAB 12: PRINT " INSERT DISC TO BE SEARCHED "
print': PRINT " DEPRESS RETURN TO CONTINUE, ANY OTHER
KEY TO EXIT PROGRAM ";: NORMAL : GET A$: PRINT A$: IF A$ < > CHR$
(13) THEN TEXT : HCME : END
70 VT = 17:VS = 0:BASE = 9216:NULL$ = "":TC = 2 " 15 - 1
80 TEXT : HOME : INVERSE
LENGTH
HEX(DEC.) ": POKE 34,3: VTAB 6: HCME
40
50
60
START
HEX (DEC.)
PEEK (BASE + 1):CS = PEEK (BASE + 2)
PEEK (BASE + 2)
90 PRINT " FILE NAME
95 PRINT "1ST 13 CHAR
100 NORMAL
170 TO = VT:SN = VS: GOSUB 880:CT
180 LC = - 1: POKE 35,21
190 GOSUB 1350: GOSUB 1530
230 TO = CT:SN = CS; GOSUB 880
280 NTC = PEEK (BASE + 1) :NSC =
340 FC» B2 = 11 TO 224 STEP 35
350 B3 = BASE + B2
360 IF PEEK (B3) = AND PEEK (B3 + 1) = THEN
- 958: PRINT : GOTO 500
370 IF PEEK (B3) = 255 THEN 390
380 PR = PEEK (B3 + 2) : IF H! = 4 OR PR = 128 + 4 THEN
390 IF LC < 16 THEN 440
400 VTAB 24: I«INT "CONTINUE (Y-N) ?
420
HTAB 1: VTAB 24: PRINT " ";
POKE 35,23
VTAB 21: CALL - 958
PRINT : VTAB 21: PRINT
GOTO 510
HTAB 1: VTAB 24: f«INT " ";
430 LC = - 1: VTAB 21
435 PRINT
440 NEXT B2
450 CT = NTC:CS = NSC
460 GOTO 230
480 R£W EXIT PROGRAM
500 VTAB 21: PRINT " NO MORE BINARY FTr.FS" „„
510 PRINT " reEE SECTORS= ";CNT: TEXT : VTAB 22: END
POKE 35,23: VTAB 21: CALL
GOSUB 540
GET A$: PRINT A$;: IF A$ = "Y" THEN
401
402
405
407
410
420
(Continued)
No, 38 -July 1981
MICRO - The 6502/6809 Journal
45
w
APPLE BONUS MMiliill—
Table 1: Input/Output Control Block (lOB)
Function
lOB type indicator
Slot number x 16
Disk drive number
Expected volume
number
Initial track number
Initial sector number
DCT address
Buffer address
Not used
Command code
(1=READ
2 = WRITE)
Error code
Actual volume
nvunber
Previous slot x 16
Previous drive
Tab/a 2: Device Characteristic Table (DCT)
Hex
Hex
Address Data
2300
01
2301
60
2302
01
2303
GO
2304
11
2305
00
2306
1123
2308
00 24
230A
00 00
230C
01
230D
00
230E
FE
230F
60
2310
01
£[ex Hex
Address Data
2311 00
2312 01
2313 EF
2314 D8
Function
Device type code
Phases per track
Time covmt
Time count
Listing 1 (Continuedi
520 END
540 RIM DISPLAY FILE PARAMETERS
620 FOR I = 3 TO 15
630 PRINT CHR$ ( PEEK (B3 + I));: NEXT I
680 TO = PEEK (B3):SN = PEEK (B3 + 1): GOSUB 880
730 ™ = PEEK (BASE + 12):SN = PEEK (BASE + 13): GOSUB 880
780 A = PEEK (BASE) + PEEK (1 + BASE) * 256:AA = A: IF AA > TC THEN AA =
AA - 2 " 16
790 L = PEEK (BASE + 2) + 256 * PEEK (BASE + 3) :LL = L: IF LL > TC THEN
LL = LL - 2 * 16
800 HTAB 15:Z = USR (M) : PRINT "("A")";
810 HTAB 28:Z = USR (LL) : PRINT "("L")"
820 LC = LC + 1
860 TO = CT:SN = CS: GOSUB 880: RETURN
880 RfM READ TBACK/SECTCR
940 POKE TA,TO: POKE SA,SN: POKE RD,1: CALL RWEfiV: RETURN
960 REM SETUPRWTS DRIVER
1090 HIMEM: 8191
1130 DATA 169,035,160,00,32,217,3,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0: REM 19 ZEROES
1140 DATA 1,96,1,0,17,0,17,35,0,36,0,1,1,0,254,96,1,0,1,239,216
1150 FOR I = 8448 TO 8474: READ J: POKE I,J:: NEXT
J: POKE I, J: NEXT
8965:RD = 8972
1160 FOR I = 8960 TO 8980: READ
1290 RWADV = 8448:TA = 8964:SA =
1300 SL = 6:DR = 1
1310 DA = 37148
1320
1330
1350
1390
POKE nA,SL * 16: POKE DA + 14, SL * 16: POKE DA + 1,DR: POKE DA + 15 ,DR
RETURN
REM DETERMINE FREE SPACE
DATA 76,0,032,32,12,225,165,160,160,0,162,9,24,42,16,1,200,202,208,
PEEK (BASE +1) * 256 + PEEK (BASE +
249,165,161,162,9,24,42,16,1,200,202,208,249,169,0,32,242,226,96,96
1400 FOR I = 10 TO 12: READ Z: POKE I,Z: NEXT
1410 FOR I = 8192 TO 8227: READ Z: POKE I,Z: NEXT
1490 CNT =
1500 FCK I = 56 TO 195 STEP 4:V =
I + 1) :V = INT (V / 2)
1510 CNT = CNT + USR (V) : NEXT : RETURN
1530 REM SETUP DEC-HEX CCNV.
1560 DATA 76,0,032,32,12,225,165,160,166,161,32,65,249,96
1570 FOR I = 10 TO 12: READ Z: POKE I,Z: NEXT I
1580 FOR I = 8192 TO 8202: READ Z: POKE I,Z: NEXT I
1590 RETURN
VTOC
TKK:-S11
SEC=
DIRECTORY
TRK • W
SEC - X
n*35+ll
n*35+12
n=0...6
TRK/SEC LIST
TRK - Y
SEC - Z
TRK - A
SEC f B
n
1
c
2
D
y
B FILE SECTOR #1
TRK = R
SEC - S
ftCDRESS Mg
unnPF.SS MSB
LENGTH LSB
T.ENGTH MSB
■ LINK TO NEXT
DIRECTORY
SECTOR
SECOND DIRECTORY SECTOR
Figure 1: What Goes Where
The rest of this explanation assvunes
that the reader is somewhat familiar
with Chapter 9 and Appendix C of the
DOS manual. If not, he should read it
before continuing with this article so
that the terminology is familiar.
When the program is RUN it first
sets HIMEM, then POKEs the first of
three machine language programs into
the protected area and asks the user to
insert the disk to be searched into the
drive. (The normal default drive of slot
6, drive 1, is used. To utilize another,
line 1300 should be changed.) Sub-
routine 960 then sets up the RWTS
driver, lOB and DCT described on page
94 of the DOS manual.
To APPLESOFT
And DOS
$2600
$2500
$2lK)0
$2315
$2311
$2300
$2100
$2000
RWTS
BUFPER
Rwrs
DRIVER
USR(x)
ROUTINE
9278
9*72
9216
.8981
8977
8960
8448
8192
HUEM set
" at 8191
Figure 2: Memory Map
46
MICRO - The 6502/6809 Journal
No. 38-July19f
APPLE BONUS
)
Listing 2
• *
;* RWTS DRIVER
RWTS ECU $3D9
lOBADD EQU 2.300
;IOB ADDRESS
2100
2100
2100
ORG $2100
?
2100
2102
2104
A923
AOOO
20D903
LDA /lOBADD
XDY #IOBADD
JSR RWTS
2107
60
RTS
; RETURN TO BASIC
The RWTS Driver (shown in Usting
2) serves to load the 6502 micro-
processor (registers A and YJ with the
lOB address, and then JSR to the entry
point of the RWTS subroutine. The
Input/Output control Block (lOB) con-
tains the critical operating parameters
for the RWTS subroutine. These are in-
itialized as shovm in table 1. The Device
Characteristics Table (DCT) has been
placed immediately follovdng the lOB.
Its contents are determined by the ac-
tual physical characteristics of the disk
drive itself, as well as the interface card
and DOS. The standard values which
DOS uses are also given in table 2.
b
*
Listing 3
» ROUTINE
TO COUNT I'S IN
*
*
INTEGER X
)
(TOINT
EQU
$E10C
I
kYTOFP
EQU
$E2F2
I
iYTA
EPZ
$A0
I
iYTB
EPZ
$A1
2000
ORG
S2000
2000
2000
2000
200CE1
JSR
XTOINT
CONVERT X TO 16-BIT INTEGER
2003
A5A0
LDA
BYTA
A=IST BYTE OF INTEGER
2005
AOOO
LDY
l$00
Y=BIT ACCUMULATOR
2007
A209
LDX
l$09
X«LOOP COUNTER
2009
18
CLC
INITIALIZE CARRY
200A
2A
.BLA
ROL
LOOK AT NEXT BIT
200B
1001
BPL
LB LB
SKI p. ACCUMULATOR IF MSB IS ZERO
200D
C8
INY
ELSE BUMP BIT ACCUMULATOR
200E
CA
-BLB
DEX
DECREMENT LOOP COUNTER
200F
D0F9
BNE
LB LA
LOOP TILL DONE
2011
A5A1
LDA
BYTE
A=2ND BYTE OF INTEGER
2013
A209
LDX
#$09
NOW
2015
18
CLC
REPEAT
2016
2A
.BLC
ROL
ABOVE
2017
1001
BPL
LBLD
FOR
2019
C8
INY
SECOND
201A
CA J
-BLD
DEX
BYTE
201B
D0F9
BNE
LBLC
201D
A900
LDA
l$00
A-0 FOR FP CONVERSION
20 IF
20F2E2
JSR
AYTOFP
CONVERT A,Y TO FLOATING POINT
2022
60
RTS
RETURN TO BASIC
•)
Listing 4
;* PRINT HEX EQUIVALENT
OF DECIMAL INTEGER
XTOINT
EQU
SEIOC
AXTOHX
EQU
$F941
BYTA
EPZ
$A0
BYTE
EPZ
$A1
0800
;
2000
ORG
$2000
2000
2000
;
2000
200CE1
JSR
XTOINT
/CONVERT X TO 16-BIT INTEGER
2003
A5A0
LDA
BYTA
iA=«S BYTE
2005
A(5A1
LDX
BYTE
;B=LS BYTE
2007
2041F9
JSR
AXTOHX
; PR INT AX IN HEX
200A
60
RTS
.-RETURN TO BASIC
Line 1090 protects all of this from
Applesoft BASIC and also protects the
short machine language program at
memory address 8192. This program is
one of two which are called by the
Applesoft USR (x) function. The USR (x)
routine defined at line 1350 (listing 3) is
used to calculate the number of free sec-
tors on the disk by utilizing the Track
Bit Map found in the Volume table of
contents (Track $11, Sector $00|. Once
this has been done the USR (x) fimction
is redefined (listing 4) to perform
decimal to hex conversion. See figure 2
for a memory map.
Referring to figure 1 for the following
discussion, the BFILE search begins by
picking up bytes 1 and 2 from the VTOC
(statement 170). (Note that byte 1 is ac-
tually the 2nd byte; the first is byte 0.)
These bytes contain the track and sector
numbers, respectively, of the first direc-
tory-sector. Once known, that sector is
read into the RWTS buffer by line 230.
Each directory sector contains up to
seven directory entries and a link to the
next directory sector. This link, in bytes
1 and 2 of each directory sector, is cap-
tinred by line 280.
Each of the seven directory entries is
35 bytes long, starting at byte 11 of the
buffer. Byte and byte 1 of each entry
(e.g. buffer bytes 1 1 and 12 for the first
entry) contain the track and sector
numbers, respectively, of the Track and
Sector List (TSL) for that entry. If both
bytes are zero, it indicates that the end
of the directory has been reached. If byte
contains a 255 (hexadecimal FF), it in-
dicates that the entry was once used, but
since has been deleted. Only if both
bytes are non-zero and less than 255 is
the entry a valid entry.
Once the entry has been determined
valid, byte 2 (of that entry) is examined
to determine the file type. A "4" in-
dicates an unprotected binary file and a
"132" indicates a protected fUe. For
No. 38 -July 1981
MICRO - The 6502/6809 Journal
47
i APPLE BONUS
either of these cases, the BFILE name is
retrieved from bytes 3 through 13 and
the track and sector numbers in bytes
and 1 are used to pull in the first sector
of the TSL for the file (line 680). (Other-
wise, the search continues with the next
directory entry.)
The TSL is normally used to link
multiple sectors of a program together.
For our purpose, only bytes 12 and 13
are of interest. These two bytes contain
the usual (by this time) track and sector
of the first valid sector of the BFILE.
Line 730 then pulls this sector into the
buffer.
After picking out the start address
and length of the BFILE (lines 780 and
790) and printing them in hex (and
decimal), line 860 restores the original
catalog sector to the buffer and the
search continues.
After the seventh directory entry,
assuming that a double-zero end-of-
directory mark is not found, the next
directory sector is loaded and the search
continues with that and each succeeding
directory sector.
Once the directory search is com-
pleted (determined by line 360) the pro-
gram prints the number of free sectors
and terminates.
The routines and techniques pre-
sented here can be utUized to imple-
ment a variety of "CATALOG" type
programs which can be tailored to the
user's individual needs. For instance,
changing line 940 from "...POKE
RD,1..." to "...POKE RD,2..." will
write the buffer to the designated sector
instead of reading from the sector to the
buffer. However, a strong word of
caution is in order: when debugging this
type of program it is extzemely easy
to erase all or part of a disk. For this
reason, always use a scratch disk when
"RUNNING" the program (until it is
thoroughly debugged) and "SAVE"
the program on another disk prior to
"RUNNING".
Clyde Camp has a BSEE from Virginia
Polytechnic Institute (1969) and an MS in
Computer Science from Southern
Methodist University (1974). He has been
employed by Texas Instruments since
1969 and is currently Systems Engineering
Manager for the Industrial Controls
division of Texas Instruments in Johnson
City, Tennessee. His system consists of an
Apple II with 48K, single disk, Heathkit
printer, Integer and Applesoft ROM.
AICRO
Our Software Catalog
Is a listing of unique
software available
through a wide
networic of vendors.
Just mention you sa\A
their ad in MICRO! If
you have a software
package to announce
to other MICRO
readers, just send for
the proper form.
Complete details will
be provided.
Software Catalog
P.O. Box 6502
Chelmsford, MA
01824
fflUersakUriier & APPLE II:
The Keys to Unlimited Graphics
DRAWING TABLET
Although VersaWriter operates on a
simple principle, it produces graphics
which match or exceed those of other
digitizers. Rugged construction, trans-
lucent base, easy to use — plugs
directly into APPLE 11.
GRAPHICS SOFTWARE
Easily the most capable and com-
plete graphics software for the home
computer available. Fast fill drawings
in 100 colors. All text in five sizes,
compile and display shapes, edit,
move and much more!
UNIQUE OFFER
See VersaWriter at your local dealer and
pick up a copy of our demonstration
disl<. The complete VersaWriter hardware
and software pacl<age is a real bargain
at $249. I^r more information call or
write:
Versa Computing, Inc. • 887 Conestoga Circle • Newbury Park, CA 91320 • (805) 498-1956
48
MICRO - The 6502/6809 Journal
No. 38 -July
'--mm
f
ions Revealed,
Part 1
w
Assemblers, compilers, and
Interpreters all have to be able
to process expressions. This
article, and the visually-oriented
Apple II programs included,
reveal the inner woriclngs of
expression processing —
scanning, parsing, and
translation.
Richard C. Vile, Jr.
3467 Yellowstone Dr.
Ann Arbor, Michigan 48105
Almost all programming languages
allow the progiimmier to fonn a variety
of expressions. In fact, expressions are
such a "fact of programming life" that
few programmers think much about
them, beyond their application in pro-
grams. Nonetheless, a smdy of the pro-
cessing of expressions by translators
such as interpreters, assemblers, and
compilers provides an interesting and
worAwhile look "behind the scenes."
In this article we shall present some
simple techniques for the scanning, par-
sing, and translation of expressions. Pro-
grams, for the Apple n computer, will be
presented which visually reveal the in-
ner workings of some of the classical
algorithms in this area.
The Makeup of Expressions
In the world of expressions, the cast
of characters consists of opeiatois and
opeiands. Operaads are themselves con-
sidered to be expressions, with the
simplest being constants and vaiiables.
Of course, constjmts and variables repre-
sent but a small portion of the entire
taxonomy of expressions. Simple expres-
sions may be combined usiag operators
to "make big ones out of little ones" (to
paraphrase a well-known saying).
Each expression, great or small,
represents a value of some type. One or
more operators appropriate to each type
are provided by a language. Table 1
catalogues some of the most common
types and operators.
Type Operators
Integer + - • /MODREM =#<> <=>=
Real + - •/■t = #<><= > =
String + (concatenation)
Boolean AND OR NOT
Table 1: Types and Operators
In the abstract, each operator must
be applied to operands which are of the
same type and are consistent with the
type of operands which are expected by
the operator. Thus, a relational operator
such as < = applies to two numbers of
the same type (both real or both integer)
and not to logical values such as TRUE
or FALSE. Likewise, the boolean
operator AND does not apply (logically)
to numerical values. Now, in the early
days of high-level programming
languages, the attitude toward such
matters was quite lenient. Operators
were allowed to ' 'coerce" their operands
into an appropriate form. After all,
everything was eventually represented
in terms of binary numbers inside the
computer anyway. So, for example, in
BASIC it is legal to write:
IFP<<Y)*(Y<Z)THEN ...
This is so since logical values are
represented by the numbers and 1 and
may be treated as integers in BASIC. We
know that the internal representation of
FALSE is 0, and consequently that the
expression (X<y) * (Y<Z) will repre-
sent FALSE if either X< Y oi Y<Z. Of
course, instead of being so clever, we
could simply have written
IF P« Y) AND (Y< Z) THEN ...
instead. Knowledge about how informa-
tion is represented inside the machine
has gradually become less and less
necessary in order to use high level
languages effectively. Consequently, the
rule of "different strokes for different
folks" is strictly enforced in languages
like Pascal. Writing the expression
[X<Y)»(Y<Z) in Pascal wUl get you a
severe scolding from the Pascal com-
piler. So, we speak of Pascal as a type-
checking or type-enforcing language.
While one way of classifying
operators is by the types of their
operands, another is by the number of
operands they require. Ninety-nine and
forty-four one-himdredths percent of all
operators require either one or two
operands. Those requiring two operands
are called binary operators, whereas
those that require only one operand are
referred to as unary operators.
The IVleaiiiiig of Expressions
In order to be evaluated by a com-
puter, expressions written in a high-
level language must first be translated
into a sequence of simpler, low-level
instructions. Such instructions may be
the machine language for a real pro-
cessor such as the 6502, or the pseudo-
code for an imaginary or virtual machine
which is imitated by an interpretive pro-
gram instead of a real processor. Each
such instruction will typically manip-
ulate only one or two operand quantities
and involve, at most, one operator. In
order to make the transition from a
higher to a lower level form^ we must be
able to decide in which order to carry
out the individual operations indicated
by the original expression. This means
that expressions which involve more
than one operator must be made unam-
biguous as to the order of evaluation.
Consider the expression X + Y ' Z.
This expression could mean either of
two quantities;
a. the resiilt of adding X and Y
followed by multiplication by Z.
b. the result of multiplying Y and Z
followed by addition of X.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
49
There is no "correct" choice between
these two possibilities, only various
conventions or methodologies dictate
which choice to make. Each high-level
language must select one such conven-
tion in order to make its expressions in-
telligible. Let us consider some of the
techniques which may be used.
Left-to-Right Evaluation
This is perhaps the simplest method.
The convention is that if we scan from
left to right in the expression, then each
operator will be evaluated as soon as it is
encountered, using the result so far ob-
tained as the "left" operand, and the
variable immediately following the
operator as the "right" operand. Using
this rule will cause oiu: sample expres-
sion to be interpreted as indicated by
possibility a described earlier. In order to
achieve the result indicated by possibili-
ty b, the expression would have to be
rewritten as: Y * Z + X.
Very few, if any, languages rely solely
on the left-to-right rule. However, nearly
all languages do use it in some contexts,
as we shall see.
Use of Parentheses to Group
Operands
Another simple way to make expres-
sions completely unambiguous is to use
"fully parenthesized" notation. This
means that enough parentheses must be
supplied in order to uniquely specify the
two operands of each operator in the ex-
pression. For the example imder discus-
sion, the two possible meanings given
would be written as:
(X -I- Y) * Z and X -(- (Y * Z)
respectively.
Precedence
^
Opeiatois
^
0/
t
Figure 1
AMBIGUOUS
EXPRESSION
&:
Rlc/(
*T^
LEFT-TO-RIGHT
EVALUATION
PRECEDENCE
OF
OPERATORS
DETERMINES ORDER
OF
EVALUATION
PARENTHESES
USED TO ALTER
"NORMAL"
PRECEDENCE
USE OF PARENTHESES
FOR CLARITY. NO
DIFFERENCE IF
THEY ARE OMITTED.
'^^
Figure 2
Precedence Rules
The method of choice in nearly all
modern languages is the use of
precedence rules. Each operator is
assigned a precedence level (or simply,
piecedence]. This establishes a "peck-
ing order" among the operators. When it
comes to the evaluation of an expression
those operators with higher precedence
levels are evaluated fiist. They take
precedence (hence the terminology) over
those operators at lower levels. Figure 1
illustrates a typical assignment of
precedence levels, in this case for the
BASIC language. Using that assigtmient
of levels, the expression X + Y * Z
would be considered equivalent to (X +
Y] * Z, since * has a hi^ier precedence
than +.
Precedence rules alone do not us
ly suffice for common practice, t
ever. Two issues are not resolved il
rely solely on precedence:
1. How do we decide the orde
evaluation of operators w
have been assigned the .s
precedence level (e.g. ' + ' and
in figure 1)?
2. How do we defeat the order
plied by the precedence leye
we so desire?
The solutions are simple! For the i
use left-to-right evaluation. For the
ond, use parentheses. Thus, using
left-to-right rule will tell us that thi
pression X + Y - Z should be b
preted to mean (X -(- Y) - Z. Likev
50
MICRO - The 6502/6809 Journal
No. 38 - July 1
(I
we may always write [X + Y) * Z, when
we desire the addition to precede the
multiplication. Parentheses may be
thought of as boosting the piecedence
levels of all the operators they contain,
in order to make them higher than all
the operators outside.
Figure 2 summarizes the techniques
and conventions under discussion,
using the expression X + Y * Z as the
example.
Translation of Expressions
The notation used in writing expres-
sions is sometimes referred to as infix
notation. This obviously derives from
the fact that the operators appear in-
between their operands:
Infix notation is potentially ambiguous
as we have seen. Translation of an ex-
pression usually replaces the hvmian
oriented infix notation with a more
machine-oriented notation.
A very common choice for the inter-
mediate representation exists which re-
quires no parentheses at all. It is known
as postfix notation and is characterized
by the fact that each operator always
immediately follows its operands. Thus,
the infix expression X + Y will be writ-
ten as follows:
OST)fi)( ncitaition
Figure 4
The order of evaluation in a postfix
notation expression is always complete-
ly specified by a single left-to-right scan.
To change the order of evaluation, the
order of the operators is changed. Figure
5 shows the two possible postfix ver-
sions of the expression X + Y * Z, cor-
responding respectively to (X + Y) * Z
and X + (Y • Z).
The fact that postfix notation is
completely unambiguous makes it a
strong candidate for use as the pseudo-
code of a virtual machine representation
for expressions. Some machines and/or
systems go so far as to use postfix nota-
tion, or Reverse Polish Notation (RPN)
as it is also called in the external
representation of expressions as well.
For example, the handheld calculators
manufactured by Hewlett-Packard re-
quire its use.
Also, one computer language which
has recentiy gained much popularity,
namely FORTH, requires that expres-
sions and statements, as well, be ex-
pressed in RPN. (A description of the
FORTH language is beyond our purpose
in this article, but we mention it to
illustrate the importance and pervasive-
ness of postfix form.)
Given that it is desirable to use RPN
as an internal form for representing ex-
pressions, we arrive at tiie first road-
block: How are parenthesized, infix
notation expressions translated into
RPN? The answer is embodied in one of
the classical algorithms of computer
science. Its description will occupy
most of the remainder of this article.
The conversion algorithm makes use
of a data structure known as a stack.
The stack concept has gradually crept
into the spotlight, especially since the
advent of the microprocessor. A stack is
a storage mechanism first of all — it
may be used to store objects of compu-
tation: niunbers, characters, strings,
records, etc. It uses a storage discipline
known as the "last- in first-out"
method: last or most recent item to be
stored in the stack is always the first to
be available for retrieval. The operations
which may be performed on a stack are:
PUSH[Item): This operation causes
"Item" to be stored at
the TOP of the stack (see
below for more on the
TOS —" Top Of Stack" ) .
POP(Loc): This operation causes
the Item currently stored
at the TOP of the stack
to be removed from the
stack, or "Popped off"
the stack and transferred
into the memory location
represented by "Loc."
The concept of Top Of Stack, abbre-
viated TOS, may be explained as
follows:
Top The last location in the stack
Of into which an item was stored
Stack is defined to be the Top Of
Stack. When a PUSH opera-
tion is performed, the Top Of
Stack is first advanced one
location, before storing the
Item being PUSHed onto the
stack. When a POP operation
is performed, the Top Of Stack
recedes by one location, after
the Item being POPped off the
stack is transferred.
When the stack is empty, that is, no
items have ever been pushed onto the
stack, then the Top Of Stack is concep-
tually one location before the first loca-
tion available for the stack. At first this
is a bit awkward for some people to
comprehend, since it means that the
"Top" of the stack is in some sense
"outside" the stack. However, since
TOS is advanced before the data is stored
during a PUSH, this awkwardness is
healed by the first PUSH operation that
takes place when a stack is used.
However, trying a POP on an empty
stack will only lead to headache #95!
When a stack is full, then TOS cor-
responds to the last location available
for stack storage. Thus any further at-
tempt to PUSH an item will cause the
stack to "overflow."
All of this may be old hat to many
readers, but for the novitiates, figures
6-8 illustrate the above terminology and
explanations. Also, if analogies are near
and dear to yoiu: heart, you may com-
pare a stack to many similar entities in
the real world: a stack of papers, a pile of
dishes, a stack of pancakes, a railroad
siding track, and so on.
Listing 1 presents an Integer BASIC
program which implements an inter-
esting game that illustrates simple
manipulations using a stack. The object
of the "game" is to rearrange a string of
digits into a different order. The original
string is in the coimting order 12... n,
where n in our implementation may be,
at most, 9. The "goal" or "target"
string is a randomly selected permuta-
tion of the original. Thus, for example,
if n = 5 the original string will be 12345
and the target string might be 53124, or
any permutation of 12345.
The rules of the game are quite sim-
ple. The original string is scanned from
left to right in order to attempt to
achieve the rearrangement. Since one
No. 38 -July 1981
MICRO - The 6502/6809 Journal
51
^ RsHftc ^r 0<*V^«
^C^ PostfwfT XfW««
Figure 5
[L^lSff SK1=^ fH>[?S(^ff (W
V
figure 6: A STACK of Integers
2
.^
Ys EH
F/gure 7: A PUSH Operation
scan may not suffice to acMeve the
target string, repeated scans are allowed
with the intermediate results copied
back into the input string. The scanning
process allows digits to be PUSHed onto
a stack and later POPped from the same
stack onto an output string. More
precisely, at each stage of a given scan,
one digit of the input string will be in
the spotlight. This digit must eventually
be PUSHed onto the stack, at which
point the scan will advance to the next
digit. However, if at any point there are
IIR
1
±
mm
-^
4
X: ' T-
<£)
Figure ft A POP Operation
LSSOP
3
EQLOP
13
ANDOP
12
EXPOP
26
MULTOP
5
PLUSOP
14
-TOS
Figure 9: A STACK of Records
digits in the stack, they may be POPped
(some or all) onto the output string. The
output string is added to at its right end,
whenever a new digit is POPped onto it.
Note that when the stack is empty, the
only option is to PUSH the current digit
and advance to the next. The input may
be copied without alteration to the out-
put by merely repeating the sequence:
PUSH POP PUSH POP ...
for as many digits as there are in the in-
put. Finally, when the scan reaches the-
end of the string, the stack will be emp-
tied onto the output.
The play of the game involves not
only achieving the rearrangement of the |
original string, but also in doing so with
the least nimiber of scans possible.
Hint: It is always possible to achieve
any target string from the original string
123... n in at most n scans. This is
because it is always possible to put one
more digit into its correct position on a
given scan.
Returning to the question of convert-
ing an infix notation expression to RPN,
the translation algorithm we shall
discuss will make use of a stack of
"operators" to assist in its job. Actually
the algorithm needs to keep track of not
only what the operators are, but also
what their precedence is in the expres-
sion being scanned. Therefore, each en-
try in the stack of "operators" will con-
tain two pieces of information: an iden-
tification of the operator concerned, and
its precedence in the expression. This
idea of a stack of "compound" items is
illustrated in figure 9. Later we shall pre-
sent two implementations of the trans-
lation algorithm, one in BASIC and one
in Pascal. The implementation in Pascal
uses a particularly convenient representa-
tion of the stack as a Pascal lecoid type.
Infix to Postfix: The Tianslation '
Mgoiithm
The input to the translation algo-
rithm will be an expression in partially
parenthesized infix form. The expres-
sion will be scanned from left to right
and dissected into its component parts:
Operands
Operators
Parentheses
(Blanks embedded in the input will be
considered to be insignificant.)
The output of the translation will
consist of a string, containing all the
operands and operators of the input, but
with all parentheses removed. The
string will represent the RPN for the
input expression.
As the input is dissected, the "ob-
ject" being scanned at any point will
determine the action to be taken. These
objects are also referred to as tokens. It
is the job of the scanner to extract
tokens. In ovu: implementations of the
translation algorithm, the scanner will
be quite simple. Each token will bei
assumed to be only a single character"
long. The scanner will examine each
52
MICRO - The 6502/6809 Journal
No. 38 -July 1981
pTOS<-0
^ 1 STACK(TOS)<-[NOOP,-2)
1 NEST«-0
L DONE <- FALSE
(— while NOT DONE do
3. TOKEN <- SCAN; |
'-case TOKEN of
OPERAND: OUTPUT(OPERAND);
LPAREN: NEST<-NEST + 1;
RPAREN: NEST <- NEST - 1;
1. '
4y
OPERATOR:
begin
6. NOWP<-NEST' 10 + PRECEDENCE(OPERATOR);
while NOWP<PRECEDENCE(TOS) do
5.
8. POPIOUTPUT);
endwhile;
7. PUSH(OPERATOR,NOWP);
end;
I p.ndcnsp,:
^ endwbile;
Figure 10: Pseudo-code for Translation Algorithm
[(X+Y)/[Z- (W*U))tA)/B
Nesting Level: 12 12 3 210
Absolute Precedence: 4 5 4 5 6 5
Relative Precedence: 24 15 24 35 16 5
Figure 11: Absolute vs. Relative Precedence
character and assign it an internal
"token number" which may be more
convenient for the remainder of the pro-
gram to manipulate.
Figure 10 presents the essential
details of the algorithm expressed in
pseudo-code. Various portions of the
program have been bracketed and/or
numbered in order to provide reference
points for further discussion.
1. Initialization
The stack is initially set up with a
"dummy entry" which is needed for
two reasons:
a. In order to allow the test in the
while loop labelled 5 to make
sense when no operators have yet
been pushed onto the stack.
b. In order to provide a way to stop
the same loop when the stack is
"emptied out" at the end of the
scanning process.
The pair (NOOP, - 2) is put onto the
bottom of the stack to accomplish these
goals. The nesting level of parentheses is
given its initial value of (in the
variable NEST), and the logical variable
DONE is set to FALSE: we can't be
DONE, we've only just begun!
2. Main Piogiam Loop
The fundamental control stracture
of the algorithm is a vfbile loop (a loop
controlled by a condition which is
tested befoie any statements of the loop
are executed on each pass through) con-
trolled by the logical expression "NOT
DONE." The variable DONE will
become TRUE when both of the follow-
ing conditions are met:
a. The input expression has been
completely scanned.
b. The OPERATOR stack has been
emptied to the output.
The details of how these tests are carried
out in the implementation may be
gleaned by studying the actual programs
of listings 2 and 3, which will be
presented in part 2, next month.
3. Token Extraction
While in general this process may be
as painful as tooth extraction, in our
case it is relatively simple. A routine
must be provided which picks off the
next character of the input and converts
it into the internal form that is used by
the remainder of the algorithm. In the
pseudo-code incamation this is called
SCAN and it is invoked each time at the
head of the main program loop. The
routine SCAN is actiially a function
(with no actual arguments) which has
its returned value assigned to the
variable TOKEN.
4. Translation Actions
The actions taken by the translator
at each step depend on the TOKEN
found. The pseudo-code uses a case
statement to select the appropriate ac-
tion based on the value of TOKEN. The
possible categories of TOKEN are:
OPERAND
LPAREN
RPAREN
OPERATOR
For each of these categories, the case
statement specifies corresponding
actions:
a. OPERANDS are immediately
copied to the output.
b. Left parentheses (LPAREN) cause
the variable NEST to increase by 1 .
c. Right parentheses (RPAREN)
cause the variable NEST to
decrease by 1.
d. OPERATORS cause the section of
code labelled 5 to be executed.
5. Stack Manipulation for Opeiatois
This section represents the heart of
the translation algorithm. Since deci-
sions are made based on the values of
PRECEDENCE, these values are
calculated for each operator (see 6
below) . In addition, operators are PUSH-
ed and POPped from the stack based on
the precedence values calculated.
6. Calculation of Opeiatoi Precedence
Each operator of the input expression
has an associated precedence calculated
according to the formula:
NOWP = NEST * 10 -)-
PRECEDENCE(OPERATOR)
No. 38 -July 1981
MICRO - The 6502/6809 Journal
53
This value represents the lelative
precedence of the operator within the
particular expression at hand. It is based
on the absolute precedence,
PRECEDENCE(OPERATORl, of the
operator and the nesting level within the
expression. The absolute values of
precedence in our implementations are
all less than 10. The factor NEST * 10 is
therefore guaranteed to boost all the
values for operators inside a given pair of
parentheses to be higher than all those
outside. Figure 11 shows a fairly com-
plex expression, with each operator
labelled with its nesting level, absolute
precedence, and relative precedence.
7. PUSHing Opemtozs onto the Stack
8. POPping Opemtois from the Stack
Each operator in the input expres-
sion must eventually be PUSHed onto
the stack; none go directly to the out-
put. When an operator is encountered in
the input, its relative precedence is
calculated and compared with that of
the operator on top of the stack. As long
as the TOS operator has highei
precedence, it will be POPped to the
output — this is expressed by the while
loop at 8. When control falls out of that
loop, the current operator is then PUSH-
ed onto the stack (i.e. the pair of values
"operator, relative precedence") and the
main loop is repeated.
Figure 12 gives a history of the ex-
ecution of the translation algorithm at
work on the input expression:
Z = (X-^Y)*(X-Y)-f-(U-HV)
For lack of space, we have shown the
stack with oidy the operator characters.
The column headed LASTP always
shows the relative precedence for the
operator at the top of the stack. The
arrows in the EXPRESSION column
mark the progress of the scan. The
column headed < ? tells whether the
current precedence is less than
PRECEDENCE(TOS).
EXPRESSION OUTPUT
NEST
NOWP LASTP <?
STACK
Z = [X + Y)'[X-Y) + (U + V)
-1
-2
F
Z = [X + Y]'(X-YJ + (U + VJ
Z=[X + YJ*(X-YJ + (U + V|
z
-1
-2
F
z
3
-2
F
=
Z = (X + YJ*(X-Y) + (U + V)
Z = |X + Y)'(X-Y) + (U + V)
Z = (X + Y)*(X-Y) + (U + V)
Z = (X + Y)*(X-Y) + (U + V)
Z = [X + Y)'(X-Y) + (U + V)
Z=(X + y)'[X-Y] + (U + V]
z
1
3
3
F
=
zx
1
3
3
F
=
zx
1
14
3
F
= +
ZXY
1
14
14
F
= +
ZXY
14
14
F
= +
ZXY
5
14
T
= +
ZXY +
5
3
F
=
ZXY +
5
5
F
= •
Z = (X + Y)'(X-Y) + (U + V)
Z = [X + Y)'(X-Y) + [U + V)
Z = (X + YJ*(X-Y) + (U + VJ
ZXY +
1
5
5
F
= *
ZXY + X
1
5
5
F
= '
ZXY + X
1
14
5
F
= •-
Z=[X + YJ'(X-Y) + |U + VJ
Z = (X + YJ*(X-Y) + (U + VJ
Z=|X + YJ*(X-Y) + (U + V)
ZXY + XY
1
14
14
F
= *-
ZXY + XY
14
14
F
= '-
ZXY + XY
4
14
T
= •-
ZXY + XY-
4
5
T
= *
ZXY + XY-'
4
3
F
=
ZXY + XY-'
4
4
F
= +
Z=|X + Y)'(X-Y) + |U + V)
Z=[X + Y)*|X-Y) + [U + V)
Z=(X + Y1*[X-Y| + |U + V)
Z = (X + Y]'(X-Y) + (U + V)
Z-jX + Y)*(X-Y) + (U + V)
t
Z = (X + Y)*|X-Y) + (U + V]
ZXY+XY-'
1
4
4
F
= +
ZXY + XY- 'U
1
4
4
F
= +
ZXY + XY- 'U
1
14
4
F
= + +
ZXY + XY- 'UV
1
14
14
F
= + +
ZXY+XY- 'UV
14
14
F
= + +
ZXY + XY- 'UV
-1
14
T
= + +
t
ZXY + XY- •UV +
-1
4
T
= +
ZXY + XY- •UV+ +
-1
3
T
=
ZXY + XY-'UV+ + =
-1
-2
F
Final Output = = = > ZXY +
XY-'UV+ + =
Figure 12: Trace of Infix to Postfix Transiation
54
MICRO - The 6502/6809 Journal
No. 38 -July 1981
10
11
15
16
17
18
19
20
21
1000
1001
1010
1012
1015
1018
1020
1025
1030
1035
1040
1099
2000
2001
2002
2003
2005
2010
2015
Listing 1
DIM STACK(9)»TARGET(9)»0UTPUT(
9)
DIH CURRENT(9)
INTRO=9000 }SETUP=8000
HQME=-936 : CLRE0L=-a&8 ; KBD=-
16384 :CLR=-16368
GETKEY=3000 :UAIT=3100 ;PERMUTE=
3200
FL"ASHINIT=3300{PUSH=3400{PULL=
3500
CHRDOLLAR=3600 tSCAN=2000
DISPLAY=3700:iNIT=3800
POINTS=3900 ; AGAIN=4000 ;RESTART=
8050
startline=2:stackline=4:menuline
= 12
0UTPUTLINE=6JTARGETLINE=9
ERRLINE=17:DEBUGLINE=17
REM MAIN PROGRAM
REM ============
GOSUB INTRO
GOSUB SETUP
GOSUB INIT
GOSUB RESTART
GOSUB SCAN
GOSUB POINTS
IF NOT DONE THEN 1015
GOSUB AGAIN
IF NOT ADDIO THEN 1012
CALL home: end
REM SCAN CURRENT STRING ONE
REM CHARACTER AT A TIME AND
REM REQUEST USER MOVES,
REM =======================
SCANPTR=1
GOSUB DISPLAY
VTAB MENULINEJ TAB 11 PRINT
" CHOOSE ONE OF THE FOLLOWING:"
2020 TAB 5: PRINT LBRA*JPU«»"] PUSH"
2022 TAB 5: PRINT LBRA$»P0«f"3 POP"
2025 VTAB ERRLINE: CALL CLREOL
2030 TAB 5: GOSUB GETKEY
2035 IF KEY#PULLKEY THEN 2040
2037 GOSUB PULL: GOTO 2015
2040 IF KEY4PUSHKEY THEN GOTO 2015
2045 GOSUB PUSH
2050 SCANPTR=SCANPTR+1
2055 IF SCANPTROSLEN THEN 2010
2060 IF STACKPTR<=0 THEN 2099
2065 GOSUB PULL: GOTO 2060
2099 RETURN
3000 REM GETKEY ROUTINE
3001 REM ==============
3005 KEY= PEEK < KBD )
3010 IF KEY<128 THEN 3005
3015 IF KEY>=161 AND KEY<=222 THEN
3040
3020 POKE CLRfO: GOTO 3005
3040 POKE CLR»0
3049 RETURN
3100 REM STANDARD WAIT ROUTINE
3101 REM =====================
3105 POKE CLRfO
3110 POKE 50f63: VTAB 24: TAB 5
3115 PRINT "PRESS ANY KEY TO CONTINUE
"f
3120 POKE 50f255
3125 IF PEEK <KBD)<128 THEN 3125
3130
POKE
CLR»0
3135
VTAB
24: TAB i: CALL CLREOL
3149
RETURN
3200
REM SET UP TARGET STRING
3201
REM AND INITIALIZE THE
3202
REM CURRENT POSITION ARRAY.
3203
REM =
:======================
3205
FOR
[=1 TO SLEN:CURRENT(I)=
i: NEXT I
3210
FOR ]
I
FOR ]
[=1 TO 9:target<i)=o: next
3215
[=1 TO SLEN
3220
L= RND <SLEN)+i: IF TARGETC
L)>0
THEN 3220
3225
TARGET(L)=I
3230
NEXT
I
3245
COUNT=0
3249
RETURN
3300
REM
POKE IN THE FLASHIT
3301
REM
SUBROUTINE
3302
REM
3305
POKE
1»201
3306
POKE
2fl60
3307
POKE
3.176
3308
POKE
4.3
3309
POKE
5.76
3310
POKE
6.240
3311
POKE
7.253
3312
POKE
8.201
3313
POKE
9.192
3314
POKE
10.176
3315
POKE
11.6
3316
POKE
12.56
3317
POKE
13.233
3318
POKE
14.64
3319
POKE
15.76
3320
POKE
16.240
3321
POKE
17.253
3322
POKE
18.233
3323
POKE
19.128
3324
POKE
20.76
3325
POKE
21.240
3326
POKE
22.253
3330
FLASH=3350 : REGULAR=337S
3349
RETURN
3350
POKE
54. i: POKE 55.0 : RETURN
3375 POKE 54.189: POKE 55.158: RETURN
3400 REM PUSH CURRENT DIGIT ONTO
3401 REM STACK,
3402 REM ========================
3405 STACKPTR=STACKPTR+1
3410 VTAB STACKLINE: TAB 10+STACKPTR
3415 PRINT CURRENT(SCANPTR)J
3420 STACK( STACKPTR )=CURRENT( SCANPTR )
3449 RETURN
3500 REM POP STACK TO OUTPUT AND
3501 REM UPDATE DISPLAY. (Continued)
No. 38 -July 1981
MICRO - The 6502/6809 Journal
55
I
3502
3503
3504
3505
3506
3507
3509
3510
3511
3515
3520
3522
3525
3530
3549
3600
3601
3602
3603
3604
3610
3615
3700
3701
3702
3705
3710
3715
3720
3725
3730
3732
3749
3800
3801
3805
3810
3811
3815
3899
3900
3901
3902
3903
3904
3910
3915
3920
3925
3926
3927
3930
3935
3950
3955
3956
3957
3960
3965
3966
IF STACKPTR>0 THEN 3509
GOsuB flash: print ""
VTAB ERRLINE: tab 5 J PRINT
"EMPTY STACK"
GOSUB regular: GOSUB WAIT
RETURN
TOS=STACK( STACKPTR )
VTAB STACKLINE: tab 10+STACKPTR
PRINT '■ "i
VTAB OUTPUTLINE: tab 18+OUTPTR
PRINT TOSf
OUTPUT< OUTPTR )=TOS
0UTPTR=0UTPTR+1
STACKPTR=STACKPTR-1
RETURN
REM CONVERT NUM TO CHARACTER
INTEGER BASIC CHR$ FUNCTION
IN USER CONTRIBUTED SOFT-
UARE.
REM
REM
REM
REM ========:===================
CHS=CHR+128*( CHR<128 )
LC1= PEEK (224):LC2= PEEK (
225)-(LC1>243){ POKE 79+LCl-
256*( LC2>127 )+< LC2-255*( LC2>
127))*256»CHS:CHR*="-": RETURN
REM DISPLAY CURRENT SCAN
REM POSITION IN INVERSE
REM ====================
GOSUB FLASH
VTAB STARTLINE: tab 18+SCANPTR
PRINT CURRENT( SCANPTR )
GOSUB REGULAR
IF SCANPTR=1 THEN RETURN
VTAB STARTLINE: TAB 18+SCANPTR-
1
PRINT CURRENT<SCANPTR-1 )
RETURN
REM INIT IMPORTANT VARIABLES
REM =========================
STACKPTR=0
0UTPTR=1
DONE=0
GOSUB FLASHINIT
RETURN
REM CHECK IF TARGET STRING
REM HAS BEEN ACHIEVED. IF
REM S0» THEN SET DONE=TRUE»
REM OTHERWISEf BUMP COUNT
REM AND SET DONE=0
FOR 1=1 TO SLEN
IF TARGET( I )*OUTPUT( I > THEN
3950.
NEXT I
REM TARGET AGREES WITH OUTPUT
REM SO WE ARE "DONE".
REM =========================
D0NE=1
COUNT=COUNT+i: RETURN
DONE=0
REM COPY OUTPUT TO CURRENT
REM FOR RESCAN. BUMP COUNT.
ppM —— — — — — — — — — — — — — — — — — — — — — -.
C0UNT=C0UNT+1
FOR 1=1 TO SLEN
CURRENT( I )=OUTPUT( I )
3967
3999
4000
4001
4002
4005
4010
4011
4012
4015
4020
4025
4030
4049
8000
8001
8005
8006
8010
8011
8015
8018
8019
8020
8021
8022
8025
8026
8027
8030
8049
8050
8051
8052
8053
8054
8055
8057
8060
8065
8070
8071
8075
8076
NEXT I
RETURN
REM SCORE PLAYER AND ALLOW
REM DECISION AS TO RETRY.
VTAB DEBUGLINE: TAB 1
GOSUB flash: print "CONGRATULATI
ONS ! "
GOSUB regular: print "YOU DID IT
IN "» COUNT f» SCANS."
PRINT "GO AGAIN? ( Y/N )" » : GOSUB
GETKEY
IF KEY»206 AND KEY«217 THEN
4005
IF KEY=217 THEN ADDIO=0
IF KEY=206 THEN ADDI0=1
VTAB DEBUGLINE: TAB i: PRINT
: PRINT : PRINT
RETURN
REM SETUP ROUTINE
REM =============
CALL HOME
CHR=2i9: GOSUB chrdollar:lbra$
=CHR$
VTAB 5: PRINT "PLEASE INDICATE L
ENGTH OF STARTING"
PRINT "STRING===>"»: CALL CLREOL
INPUT SLEN: IF SLEN>=1 AND
SLEN<=9 THEN 8020
PRINT "TRY AGAIN"
GOTO 8010
VTAB 7: PRINT "PLEASE HIT KEY YO
U WISH TO"
PRINT "USE FOR A PUSH"*: GOSUB
GETKEY :PUSHKEY=KEY
chr=pushkey: cosub chrdollar:
pu«»chr«
vtab 9: tab i: print "please hit
key you wish to"
print -use for a pop"?: gosub
GETKEY :PULLKEY=KEY
chr==pullkey: gosub chrdollar:
PO*=CHR«
GOSUB PERMUTE
RETURN
REtl RESTART ROUTINE
rem called if new scan is
rem needed} i.e. target
rem not reached.
call home
vtab startline: print "starting
position:"?
FOR 1=1 TO slen: print CURRENT(
I)ii NEXT I
VTAB STACKLINE: TAB i: PRINT
"STACK===>"
VTAB OUTPUTLINE : TAB i: PRINT
"OUTPUT position:"
VTAB targetline: tab i: print
"TARGET string:"?
FOR 1=1 TO slen: print TARGET(
I)»: NEXT I
VTAB 23: TAB i:chr=pushkey:
GOSUB chrdollar
PRINT "KEY FOR PUSH= ' " f CHR«
KEY FOR POP= '" '
{Continued,
56
MICRO - The 6502/6809 Journal
No. 38 -July 198-
8077 chr=pullkey: gosub chrdollar:
PRINT CHRi;
8078
8099
9000
9001
9002
9010
9015
RETURN
REM INTRODUCTION AND RULES
REM OF PLAY.
REM ======================
CALL HOME
PRINT " WELCOME TO THE GAME OF
STACK!"
9016 PRINT : PRINT "THE OBJECT IS TO
REARRANGE A STRING"
9017 PRINT "OF DIGITSf SUCH AS 123456
f INTO A "
9018 PRINT "DIFFERENT ORDER* SUCH AS
615342 » "
9019 PRINT "THE ORIGINAL STRING IS SC
ANNED FROM LEFT" f
9020 PRINT "TO RIGHT, AT EACH DIGIT
YOU HAVE THE"
9021 PRINT "FOLLOWING OPTIONS:"
9022 PRINT ; TAB 5: PRINT "PUSH ===>
PUTS THE CURRENT DIGIT ON"
9023 TAB 15: PRINT "THE STACK* AND CA
USES THE"
9024 TAB 15: PRINT "SCAN TO GO TO THE
NEXT"
9025 TAB 15: PRINT "DIGIT,": PRINT
9026 TAB 5: PRINT "POP ===> TRANSFER
S THE TOP OF THE"
9027 TAB 15: PRINT "STACK TO THE OUTP
UT AND"
9028 TAB 15: PRINT "ALLOWS ANOTHER AC
TION -"
9029 TAB 15: PRINT "I,E, PUSH OR POP
- BEFORE"
9030 TAB 15: PRINT "ADVANCING THE SCA
N."
9035 GOSUB WAIT
9040 CALL HOME
9045 VTAB 5: TAB i: PRINT " THE NUMB
ER OF DIGITS TO BE"
9050 PRINT "REARRANGED IS CHOSEN BY T
HE PLAYER*"
9051 PRINT "AS WELL AS THE KEYS TO BE
USED TO "
9052 PRINT "INDICATE A PUSH OR A POP,
II
9053 PRINT : PRINT " THE ORIGINAL ST
RING WILL BE SCANNED"
9054 PRINT "REPEATEDLY UNTIL THE TARG
ET STRING IS"
9055 PRINT "ACHIEVED, THE SCORING IS
BASED ON THE"
9056 PRINT "NUMBER OF SCANS REQUIRED
FOR THE"
9057 PRINT "PLAYER TO REACH THE TARGE
T POSITION."
9998 GOSUB WAIT
9999 RETURN JVICRO"
I-
II
GET MORE
GET MORE
GET MORE
OUT OF YOUR APPLE
WITH MICRO ?h". APPLE
MICRO/Apple
Over 30 Apple Pro-
grams on Diskette —
For Less Than $1.00
Apiece! No Need to
Type in Hundreds of
Lines of Code!
224 page bool< and
disl<ette $24.95*
* Add $2.00 for surface
shipping. Massachu-
setts residents add 5%
for sales tax.
MICRO'S new book for Apple II users lets you
• Speed up programming in Applesoft and
Integer BASIC!
• Add Apple II Plus editing features — at
no cost!
• Round and format numbers accurately In
business applications!
• Get lowercase letters and punctuation
into Applesoft strings — at no cost!
Do a shape table easily and correctly!
Play the hit game "Spelunker"!
And much, much more!
With MiCRO/Apple 1, the first volume in
our new series, you receive:
• 30 choice articles from IVliCRO (1977-80),
complete with listings, all updated by
the authors or MICRO staff,
plus
• 38 tested programs on diskette (23 sec-
tor, 3.2 DOS format, convertible to 3.3).
Ask for MICRO/Apple at your computer
store or Call Toll Free
800-227-1617
Extension 564
In California, call 800-772-3545, Extension 564
VISA and Mastercard Accepted
MICRO
34 Chelmsford Street
P.O. Box 6502
Chelmsford, MA 01824
No. 38 -July 1981
MICRO - The 6502/6809 Journal
57
The Newest In
Apple Fun
We've taken five of our most popular programs and
combined them into one tremendous paclcage full of
fun and excitement. This dislc-based paclcage now of-
fers you these great games;
Mimic — How good is your memory? Here's a chance
to find out! Your Apple will display a sequence of
figures on a 3 X 3 grid. You must respond with the ex-
act same sequence, within the time limit.
There are five different, increasingly difficuh ver-
sions of the game, including one that will Iceep going
indefinitely. Mimic is exciting, fast paced and
challenging— fun for all!
Air Flight Simulation— Your mission: Take off and
land your aircraft without crashing. You're flying
blind — on instruments only.
A full tank of fuel gives you a maximum range of
about 50 miles. The computer will constantly display
updates of your air speed, compass heading and
altitude. Your most important instrument is the Angle
of Ascent/Bank Indicator. It tells if the plane is climb-
ing or descending, whether banking into a right or left
turn.
After you've acquired a few hours of flying time,
you can try flying a course against a map or doing
acrobatic maneuvers. Get a little more flight time
under your belt, the sky's the limit.
Colonnaster — Test your powers of deduction as you
try to guess the secret color code in this Mastermind-
type game. There are two levels of difficulty, and three
options of play to vary your games. Not only can you
guess the computer's color code, but it will guess
yours! It can also serve as referee in a game between
two human opponents. Can you make and break the
color code . . . ?
Star Ship Attack— Your mission is to protect our or-
biting food station satellites from destruction by an
enemy star ship. You must capture, destroy or drive
off the attacking ship. If you fail, our planet is
doomed . . .
Trilogy — This contest has its origins in the simple
game of tic-tac-toe. The object of the game is to place
three of your colors, in a row, into the delta-like, mul-
ti-level display. The rows may be horizontal, vertical,
diagonal and wrapped around, through the "third di-
mension". Your Apple will be trying to do the same.
You can even have your Apple play against itself!
Minimum system requirements are an Apple II or
Apple II Plus computer with 32K of memory and one
minidisk drive. Mimic requires Applesoft in ROM, all
others run in RAM or ROM Applesoft.
Order No. 0161AD $19.95
Solar Energy For The Home
With the price of fossil fuels rising astronomically, solar space-heating systems are starting to become very
attractive. But is .solar heat cost-effective for you? This program can answer that question.
Just input this data for your home: location, size, interior details and amount of window space. It will then
calculate your current heat loss and the amount of gain from any south facing windows. Then, enter the data
for the contemplated solar heating installation. The program will compute the NET heating gain, the cost of
conventional fuels vs. solar heat, and the calculated payback period— showing if the investment will save you
money.
Solar Energy for the Home: It's a natural for architects, designers, contractors, homeowners. . .anyone
who wants to tap the limitless energy of our sun.
Minimum system requirements are an Apple II or Apple II Plus with one disk drive and 28K of RAM.
Includes AppleDOS 3.2.
Order No. 0235AD (disk-based version) $34.95
Math Fun
Paddle Fun
This new Apple disk package requires a steady eye and a quick hand at the game paddles! It includes:
Invaders— You must destroy an invading fleet of SS flying saucers while dodging the carpet of bombs they
drop. Your bomb shelters will help you — for a while. Our version of a well known arcade game! Requires Ap-
plesoft in ROM.
Howitzer- This is a one or two person game in which you must fire upon another howitzer position. This pro-
gram is written in HIGH-RESOLUTION graphics using different terrain and wind conditions each round to
make this a demanding game. The difficulty level can be altered to suit the ability of the players. Requires Ap-
plesoft in ROM.
Space Wars— This program has three parts: (I) Two flying saucers meet in laser combat— for two players, (2)
two saucers compete to see which can shoot out the most stars — for two players, and (3) one saucer shoots the
stars in order to get a higher rank— for one player only. Requires Applesoft.
Golf — Whether you win or lose, you're bound to have fun on our 18 hole Apple golf course. Choose your
club and your direction and hope to avoid the sandtraps. Losing too many strokes in the water hazards? You
can always increase your handicap. Get off the tee and onto the green with Apple Golf. Requires Applesoft.
The minimum system requirement for this package is an Apple II or Apple II Plus computer with 32K of
memory and one minidisk drive.
Order No. 0163AD $19.95
The Math Fun package uses the techniques of immediate feedback and positive reinforcement so that
students can improve their math skills while playing these games:
Hanging— A little man is walking up the steps to the hangman's noose. But YOU can save him by answering
the decimal math problems posed by the computer. Correct answers will move the man down the steps and
cheat the hangman.
Spellbinder— You are a magician battling a computerized wizard. In order to cast death clouds, fireballs and
other magic spells on him, you must correctly answer problems involving fractions.
Whole Space — Pilot your space craft to attack the enemy planet. Each time you give a correct answer to the
whole number problems, you can move your ship or fire. But for every wrong answer, the enemy gets a
chance to fire at you.
Car Jump— Make your stunt car jump the ramps. Each correct answer will increase the number of buses your
car must jump over. These problems involve calculating the areas of different geometric figures.
Robot Duel— Fire your laser at the computer's robot. If you give the correct answer to problems on calculat-
ing volumes, your robot can shoot at his opponent. If you give the wrong answer, your shield power will be
depleted and the computer's robot can shoot at yours.
Sub Attack— Practice using percentages as you maneuver your sub into the harbor. A correct answer lets you
move your sub and fire at the enemy fleet.
All of these programs run in Applesoft BASIC, except Whole Space, which requires Integer BASIC.
Order No. 0160AD $19.95
Skybombers —
Two nations, seperated by The Big Green Moun
tain, are in mortal combat! Because of the terrain
their's is an aerial war— a war of SKYBOMBERS!
In this two-player game, you and your opponen
command opposing fleets of fighter-bombers arme
with bombs and missiles. Your orders? Fly over th
mountain and bomb the enemy blockhouse into dust
Flying a bombing mission over that innocent look
ing mountain is no milk run. The opposition's aircral
can fire missiles at you or you may even be destroyei
by the bombs as they drop. Desperate pilots may evei
ram your plane or plunge into your blockhouse, sui
cidally.
Flight personnel are sometimes forced to parachut
from badly damaged aircraft. As they float helpless!
to earth, they become targets for enemy missiles.
The greater the damage you deal to your enemy, th
higher your score, which is constantly updated at th
bottom of the display screen.
The sounds of battle, from exploding bombs to th
pathetic screams from wounded parachutists, remini
each micro-commander of his bounden duty. Pres
On, SKYBOMBERS— Press On!
Minimum system requirements: An Apple II or Ap
pie II Plus, with 32K RAM, one disk drive and gam
paddles.
Order No. 0271AD (disk-based version) $19.95
Instant Software
58
MICRO - The 6502/6809 Journal
*A trademark of Apple Computer Inc.
PETERBOROUGH, N.H. 0345?
603-924-7296
No. 38- July 1
\
Apple* Software
From Instant Software
Santa Paravia and Fiumaccio
Buon giorno, signore!
Welcome to the province of Santa Paravia.
As your steward, I hope you will enjoy your
reign here. I feel sure that you will find it, shall
we say, profitable.
Perhaps I should acquaint you with our little domain. It is not a
wealthy area, signore, but riches and glory are possible for one who
is aware of political realities. These realities include your serfs. They
constantly request more food from your grain reserves, grain that
could be sold instead for gold florins. And should your justice
become a trifle harsh, they will flee to other lands.
Yet another concern is the weather. If it is good, so is the harvest.
But the rats may eat much of our surplus and we have had years of
drought when famine threatened our population.
Certainly, the administration of a growing city-state will require
tax revenues. And where belter to gather such funds than the local
marketplaces and mills? You may fmd it necessary to increase custom duties or tax
the incomes of the merchants and nobles. Whatever you do, there will be far-
reaching consequences . . . and, perhaps, an elevation of your noble title.
Your standing will surely be enhanced by building a new palace or a magnificent
cattedrale. You will do well to increase your landholdings, if you also equip a few
units of soldiers. There is, alas, no small need for soldiery here, for the unscrupulous
Baron Peppone may invade you at any time.
To measure your progress, the official cartographer will draw you a mappa. From
it, you can see how much land you hold, how much of it is under the plow and how
adequate your defenses are. We are unique in that here, the map IS the territory.
I trust that I have been of help, signore. I look forward to the day when I may ad-
dress you as His Royal Highness, King of Santa Paravia. Buonafortuna or, as you
say, "Good luck". For the Apple 48K.
OnJer No. 0174A $9.95 (cassette venion).
Order No. 0229AD $19.95 (disk version).
TO SEE YOUR LOCAL INSTANT SOFTWARE DEALER OR USE THE ORDER FORM BELOW
ORDER
For Fast
Service
^;/
^
ToU-Free
1-800-258-5473
Apple Cassettes
0OI8A Golf $7.95
(»25A Mimic $7.95
0040A Bowling/Trilogy $7.95
0073A Math Tutor i $7.95
0079A Oil Tycoon $9.95
OOSOA Sahara Warriors $7.95
CI088A Accounting Assistant $7.95
0094A Mortgage w/Prepayment Option/
Rnancier $7.95
tX»6A Space Wars $7.95
0098A Math Tutor II $7.95
0174A Santa Paravia and Fiumaccio $9.95
014SA Air Flight Simulation $9.95
We Guarantee It!
.y^ Guarantee *^^(:^_^ '
OUR PROGRAMS ARE GUARANTEED
TO BE QUALITY PRODUCTS. IF NOT
COMPLETELY SATISFIED YOU MAY
RETURN THE PROGRAM WITHIN 60
DAYS. A CREDIT OR REPLACEMENT
WILL BE WILLINGLY GIVEN FOR
ANY REASON.
109
Name
Address
City
. State .
-Zip-
a Check D Money Order D VISA D AMEX a Master Charge
Card No Exp. Date
Signed ^^^^^^^^^^^^^^__^^^^^^^^^^^^^^^^^^ Date
^^^^^^^^^1 Oixter your Software today! ^^^^^^^^|
Quantity
Order No.
Program name
Unit cost
Total cost
Shipping and handling
11.00
lv%/«4w
^^4-C
Total order
Peterborough, N.H. 03458
No. 38 -July 1981
MICRO - The 6502/6809 Journal
59
I
I ■
Apples
don't
rot!
Neither do other microcomputer
systems. So why pay for a new
machine when a used one can be just as good?
The Used Computer Exchange offers a unique, nationwide
listing service which puts buyers and sellers of used micro
systems and peripherals together quickly, and you pay
only for results .
We also provide advice about pricing, what to include in an
offer, how to handle shipping, and how to protect yourself.
In addition, we offer the Used Micro-Trends Report for
$6.75 with complete data on key manufacturers, models,
price histories, maintenance costs, lowest discount houses,
and much more.
TO BUY OR SELL, LIST WITH US.
CALL us TOLL-FREE
800-327-9191
(EXTENSION 61)
DC AREA 703-471-0044
JBED
canpuTER
EXCHflMGE
E NATIONWIDE LISTING SERVICE FOR
ED MICROCOMPUTER EQUIPMENT
M
M
M
M
I
END FRUSTRA TIONH
FROM CASSETTE FAILURES
PERRY PERIPHERALS HAS
THE HDE SOLUTION
OMNIDISK SYSTEMS (5" and 8")
ACCLAIMED HDE SOFTWARE
• Assembler, Dynamic Debugging Tool,
Text Output Processor, Comprehensive
Memory Test
• HDE DISK BASIC NOW AVAILABLE
PERRY PERIPHERALS S-100 PACKAGE
Adds Omnidisk (5") to
Your KIM/S-100 System
• Construction Manual — No Parts
• FODS & TED Diskette
• $20. +$2. postage& handling. (NY resident*
add 7% tax) (specify for 1 or 2 drive system)
Place your order with:
PERRY PERIPHERALS
P.O. Box 924
Miller Place, N.Y. 11 764
(516)744-6462
Your Full-Line HDE Distributor/ Exporter
erendipity
a±h Tools
for your
INTER-STAT™ offers you a full range of interactive statistical
analysis techniques, from averages and medians to binomial
and poisson distributions, correlation coefficients and one- and
two-way analysis of variance. $169.
ADVANCED MATH ROUTINES is the mathematical tool kit
for common, yet complex numerical problems. Routines include:
linear regression, matrix operations, numerical calculus.
differential equations and data set recall for iterative calculations.
$169.
Thoroughly tested, well documented and easy to master, each
package includes a 30+ page self-teaching manual.
Serendipity's complete line of software solutions for business,
education and professional applications are available at your
local Computerland or Apple dealer.
For a free brochure, or to order direct contact Serendipity
Systems, 225 Elmira Road, Ithaca, NY 14850.
Phone 607-277-4889. Visa and MC accepted.
"Apple Computer
SEBENMMTY SYSTEMS
pet & apple ii users
Tiny Pascal
Plu« +
GRAPHICS
The TINY Pascal System turns your APPLE II micro Into a 16-bit P-machlne. You
too can learn the language that Is stated to become the successor to BASIC. TINY
Pascal offers the following:
* LINE EDITOR lo Create, modify and maintain source
* COMPILER to produce P-code, the assembly langauage of the P-machlne
* INTERPRETER to execute the compiled P-code (has TRACE)
* SIruelurad programmed eonetnicts: CASE-OF-ELSE, WHILE-DO, IF.THEN-
ELSE, REPEAT-UNTIL, FOR-TO/DOWNTO-DO, BEQIN-END, MEM, CONST,
VAR ARRAY
Our new TINY Pascal PLUS-f provides graphics and other bulltin functions:
GRAPHICS, PLOT, POINT, TEXT, INKEY, ABS AND SQH. The PET version sup-
ports double density plotting on 40 column screen giving 80 x 50 plot positions.
The APPLE tl version supports LORES and for ROM APPLESOFT owners the
HIRES graphics plus other features with: COLOR, HGRAPHICS, HCOLOR,
HPLOT, PDL and TONE. For those who do not require graphics capabilities, you
may still order our original Tiny Pascal pacltage.
TINY Paaeal PLUS+ GRAPHICS VERSION-
PET 32K NEW Rome cassette «55
PET32K NEW Roms diskette KSO
APPLE II 32K/48K w/DOS 3.2 or 3.3 S50
TINY Paaeal NON-GRAPHICS VERSIONS-
PET 16K/32K NEW Roms cassette $40
PET 16Ky32K NEW Roms dIsKette $35
APPLE II w/ROM Applesoft 32K w/DOS $35
APPLE II w/RAM Applesoft 48K w/DOS $35
USER'S Manual (refundable with software order) $10
6902 Assembly Listing of INTERPRETER-graphlcs $25
6S02'Assembly Listing of INTERPRETER-non graphics. . $20
FREE po«.g« k* U.S. Md CANADA. Ordw. mcy tM pnfMhl Of by bankcwtf (IfkIimI. eird
nwnMr mi •KPtfaHon data). MIefilgan rtMdwit. Includ. 4% Hal. vAm iu. Ordara ac-
cavtad via THE SOURCE - CI.Ot52.
ITIfWIHI!l
II H J
ABACUS SOFTWARE
P.O. Box 7211
Grand Rapids, Michigan 49510
(616)241-5510
60
MICRO - The 6502/6809 Journal
No.38-July19f
Ml
II Electronic Typing Program
for the Appie
A minimal word processor in
BASIC for the Apple II that edits
one-line-at-a-time.
Thomas D. Brock
1227 Dartmouth Rd.
Madison, Wisconsin 53705
Although the Apple n was not really
designed with word processing in
mind, it is adaptable to a number of
available word processing software
packages. Some of these packages are
not as sophisticated as office-oriented
word processors, but several work very
well.
However, all word processing pack-
ages for the Apple are fairly involved
programs, and require not only a disk
system but a large amovmt of memory.
They do sophisticated file handling,
formatting, line justification, and
various editing functions. These
features are fine for office-oriented or
article-writing tasks, but if you're only
interested in writing a letter, you don't
need disk back-up copies or fancy for-
matting. You'd probably like to just sit
down at your Apple, type the letter,
then have it printed and ready to tear
off and mail.
It was with this idea in mind that I
wrote the Apple electronic typing pro-
gram. This program lets you enter text
a line-at-a-time, edit the line on the
screen, and then print it when a car-
riage return is pressed. As the line is
printed, the screen is cleared and
another line can be typed in at the same
time that the previous line is being
printed. Thus, you don't have to wait
for a print function. When the typing is
finished, the letter is already printed
and ready to be sent. Simple screen-
» oriented editing is permitted, but once
you press the carriage return, the line
starts going to the printer and can no
longer be changed.
No. 38 -July 1981
Although this problem originally
motivated me to write this program,
once I got into the programming details
I discovered I was learning a lot about
how some of the more sophisticated
word processing packages operated. I
decided to implement both forward and
backward spacing for editing, word
wrap (this is a feature that avoids
breaking a word in the middle when
typing reaches the end of the standard
40-character Apple screen; the whole
word is moved down to the following
line, making reading and proofing of
text much easier), upper and lower
case, tabbing, and single and double
spacing. Although each of these
features adds to the overhead of the pro-
gram and slows it down, I thought they
were useful and left them in. Most of
the features can be easily deleted if they
don't suit your needs.
This program was written in Integer
BASIC because Applesoft was simply
too slow to handle it. The procedure is
to do all of the character display on the
screen, by direct POKEs into screen
memory. PRINT statements are used
only to send text out to the printer. The
character called by the keyboard is
determined by PEEKing the keyboard
memory location ( - 16384), which is
the way in which the Applesoft GET
function is handled in Integer BASIC.
At the same time that the keyboard
character is POKEd to the screen, it is
POKEd to one of two alternating print
buffers in memory. If a line is to be
printed (as signalled by a carriage
return), a flag is set, and the line is
printed character-by-character imtil an
end-of-line indicator is reached. The
keyboard can interrupt the print
routine at any time to direct a character
to the next line forming on the screen,
but another carriage return will not be
recognized imtU the previous line is
completely printed. A fast typist might
be able to get ahead of the printer, but if
you are composing a letter at the
keyboard, as the program intends, then
you are usually typing slowly enough
MICRO - The 6502/6809 Journal
so that keyboard interrupts do not in-
terfere with the print function. (Under
no conditions will a fast typist wipe out
part or all of an unprinted line. If
keyboard interrupts come too frequent-
ly during a print cycle, all that will
result is that you will have to type
more slowly and/or wait at the end of
the second line imtil the first line is
printed.)
The reason two print buffers are
used alternately is because the print
fimction looks for an end-of-line flag,
which is always inserted in the location
next to that one just specified by the
keyboard. If only a single print buffer
were used and you type too rapidly, the
second line could overprint part of the
first line and a new end-of-line flag in-
serted, thus prematurely terminating
printing.
Margins are set in a simple and
direct way. When the program is first
run, with the print head at the full left
side of the printer, the operator is asked
to move the paper into the position
desired for the left margin. Then, using
the Apple keyboard, the user spaces
across the page, watching the print
head move across the printer until the
desired right margin is reached, at
which point a carriage return is sent,
and the margins are set. The screen
now goes blank and a cursor is posi-
tioned at the left end of one of the mid-
dle rows of the Apple screen. To signify
the right margin on the screen, a ver-
tical bar is inserted, usually down and
to the right on the following line
(unless very narrow margins of less
than 40 characters are being used) .
If word wrap moves a word to the
second line, the vertical bar moves
over, so that the vertical bar always in-
dicates the true right margin, as it will
appear on the printer. When the typist
reaches a point seven spaces from the
right margin, a bell will ring. It is possi-
ble to overtype the right margin that
has been set, although this would not
61
be desirable for any more than a few ex-
tra characters.
All of the characters typed at the
keyboard will be displayed in normal
video and will be printed in lower case
on the printer. To obtain a single upper
case character, it is preceded with an
ESCAPE; it will then be displayed in in-
verse video, and subsequently printed
upper case. To obtain a series of upper
case characters, precede them with a
' 'control-A." All subsequent characters
will then be displayed in inverse video
and printed as upper case until a
"control-S" is typed.
While the system is printing, you'll
notice that a line of mostly garbage un-
folds at the top of the screen, except for
the upper case characters, which will
appear normally. The garbage arises
because the Apple interprets ASCII
characters in a different manner than
the printer. As outlined in table 7, page
15, of the Apple Refeience Manual, the
character that will appear on the Apple
screen can be either an upper case let-
ter, a munber, or a special character
(such as a period, comma, or colon).
If the ASCn code used is less than
64, then the character will appear on
the screen in inverse video. If the ASCII
code used is between 64 and 127, then
the character will appear on the screen
as a flashing character. ASCII codes be-
tween 128 and 159 are control
characters, but appear on the screen as
normal video (if they are POKEd to the
screen, but not if placed on the screen
with a PRINT statement). ASCII codes
from 160 to 223 will appear as normal
video, whereas ASCII codes of 224 to
255 will appear on the screen as
numbers or special characters.
As if it isn't bad enough having
three separate screen codes for the
same character, depending upon
whether it is inverse, flashing, or nor-
mal, we must also remember that the
ASCn code generated by the keyboard,
(which we read at memory location
- 16384) is different from the ASCII
code that the printer recognizes. From
the keyboard, the high bit is set, so that
the ASCn codes run from 128 to 255,
whereas the printer recognizes the
ASCn code without the high bit, so it
requires codes from 1 to 127. For-
timately, all we need to do to convert
the keyboard code to the printer code is
to subtract 128.
Another problem arises at this
point. If we are to know where we are
on the screen, we need a cursor. Since
we are doing everything with screen
POKEs, a cursor is not automatically
:
2
3
10
11
12
15
20
30
40
45
50
80
90
100
110
120
130
140
150
160
170
180
190
200
205
210
220
230
240
250
255
300
310
320
330
1000
1010
1020
1030
1040
1050
1060
1070
1080
1090
1095
1100
1110
1120
1130
1140
1150
1160
1170
2000
2002
2003
2004
2005
2010
2020
2030
2040
2045
2048
2050
2052
2060
2070
3000
3005
3010
3020
3030
3040
3045
3047
3048
3050
3060
3070
3080
3090
3100
3105
3110
3120
4000
4005
4007
APPLE ELECTRONIC TYPING PROGFAH
BY THOMAS D. BROCK
REM
REM
REM
DIM CHRS{126): FOR 1=129 TO 255: POKE 1927+ { I-l ) , I : NEXT I: POKE 2182
,30
GOSUB 8000
CALL -936: VTAB 13
INPUT "SINGLE OR DOUBLE SPACE (1/2) ",DS
PR#PN
CALL -936
S=l 320 : S1=S : J=0 : P=768 :T1=768 : AC=0
J1=39:F1=0:K1=1
B=0:FL=0
POKE 34,24: POKE S,96: POKE TERM, 219
F=0
UC=AC
X= PEEK (-16384)
IF X=129 THEN AC=32
IF X=147 THEN AC=0
IF X=129 OR X=147 THEN GOTO 100
IF X=137 THEN GOTO 5000
IF X=138 THEN GOTO 5500
IF X=155 THEN UC=32
IF X=155 THEN GOTO 110
IF X=136 THEN GOTO 3000
IF X=149 THEN GOTO 4000
IF X=154 THEN GOTO 7000
IF X>127 THEN GOTO 1000
IP F*0 THEN GOTO 100
A= PEEK (PI)
IF AI255 THEN GOTO 300
IF DS=2 THEN PRINT CHRS (10 , 10) ;
GOTO 90
AS=CHR$(A,A)
PRINT A$j
P1=P1+1
GOTO 100
POKE -16368,0
X1=X-128
IF Xl>=64 THEN Xl=Xl+32-UC
IF X>=192 THEN X=X-{UC*6)
POKE S1,X
POKE P,X1
POKE P+1,255
IF X=141 THEN GOTO 2000
P=P+1
J=J+1
B=B+1
IF J=39 THEN GOSUB 6000
IF B-MARGIN-7 THEN PRINT CHR$(7,7);
S1=S+J
X= PEEK (SI)
IF X>=192 THEN X=X-128
IF X<192 AND X>=160 THEN X=X-64
POKE S1,X
GOTO 100
IF F=l THEN POKE 81,96
IF F=l THEN GOTO 100
P1=T1
UC=0
B=0
POKE 34,0
CALL -936
POKE 34,24
S=1320:J=0:F=1:S1=S:FL=0
Jl=39
T=F1:F1=K1:K1=T
P=768+F1*100
T1=P
POKE S,96: POKE TERM, 219
GOTO 100
POKE -16 368,0
X= PEEK (SI)
IF X<»127 AND X>=96 THEN X=X+64
IF X>-64 AND X<=95 THEN X=X+1 28- (3*FL)
POKE S1,X
J=J-1
P=P-1
B=B-1
FL=0
IF J-127 THEN J=J1
IF J<0 THEN J=0
S1=S+J
X» PEEK (SI)
IF X>«192 THEN X-X-128
IF X<192 AND X>-160 THEN X=X-64
IF X<«63 THEN FL-64
POKE S1,X+FL
GOTO 100
POKE -16368,0
X« PEEK (SI)
T-X
(Continued)
1 i
62
MICRO - The 6502/6809 Journal
No. 38 -July 198
I
40i0 IF X<=127 A»D X>=96 THEN X=X+64
4020 IF X>=64 AND X<=95 THEN X=X+1 28- (3*FL)
4025 POKE S1,X
4030 IF FL=0 AND T<=95 THEN LC=32
4032 IF T<=95 THEN X1=T+LC
4034 IF T<=127 AND T>=96 THEN Xl=T-64
4035 POKE P,X1
4037 LC=0
4040 J=J+1
4 045 P=P+1
4047 B=B+1
4048 FL=0
4050 IF J=JI+1 THEN J=128
4060 IF a>TERM THEN J=TERM
4070 S1=S+J
4080 X= PEEK (SI)
4090 IF X>=192 THEN X=X-128
4100 IF X<192 AND X>=160 THEN X=X-64
4105 IF X<=63 THEN FL=64
4110 POKE S1,X+FL
4120 GOTO 100
5000 POKE -16368,0
5005 FOR 1=1 TO 5
5010 POKE SI, 160
5020-POKE P,32
5030 J=J + 1
5040 IF J=40 THEN J=128
5050 P=P+1
5055 B=B+1
5060 S1=S+J
5070 NEXT I
5075 POKE SI, 96
5080 POKE P+1 ,255
5090 GOTO 100
55O0 POKE -16368,0
5505 FOR 1=1 TO 30
5510 POKE SI, 160
5520 POKE P,32
5530 J=J+1
5540 IF J=40 THEN J=128
5550 P=P+1
5555 B=B+1
5560 S1=S+J
5570 NEXT I
5575 POKE SI, 96
5580 POKE P+1, 255
5590 GOTO 100
6000 TEMP=TERM
6002 Jl-J
6005 X= PEEK (SI I
6010 IF X=160 OR X=96 THEN GOTO 6100
6020 R=R+1
6030 Sl-Sl-1
6040 GOTO 6000
6100 J=128
6110 I"=0
6112 IF I=R THEN GOTO 6162
6113 1=1+1
6115 S1=S1+1
6120 X= PEEK (SI)
6130 POKE SI, 160
6140 POKE S+J,X
6150 J=J+1
6160 GOTO 6112
6162 POKE TEMP, 168
^165 TEMP=TEMP+R
6170 POKE TEMP, 219
ol75 Jl-Jl-R-1
6180 R=0
6190 S1=S+J
6200 TiETUBN
7000 PR#0
7010 POKE 34,0
7020 CALL -936
7030 VTAB 10
7040 PRINT "YOU WILL HAVE TO RECONNECT
7050 END
8000 CALL -936: VTAB 10
8001 INPUT "WHAT SLOT FOR PRINTER", PN
8003 MARGIN=60
8005 INPUT "DO YOU WANT TO SET
8010 IF Y$t"Y" THEN TERM=1468
8015 IF YSI"Y" THEN RETURN
8017 PR-fPN: PRINT CHR$ (13,13) ,■ : PR#0
8018 VTAB 10
8020 PRINT "ADJUST PRINT HEAD AND PAPER
8030 PRINT "THEN SPACE ACROSS TO RIGHT MARGIN"
8040 PRINT "YOU MAY ALSO BACKSPACE"
8041 PRINT "WHEN YOU HAVE PROPER RIGHT
DOS BY TYPING "PR #0"
MARGINS (Y/N)",V$
FOR LEFT MARGIN"
MARGIN, PRESS RETURN"
(Continued)
generated and we must provide one.
The procedure here is to read the
character next to the one we have just
inserted on the screen and convert it to
flashing. This is done by PEEKing at
the location jtist after the one we have
POKEd, adjusting its value appropriate-
ly to make it flash, and POKEing it
back where we found it. Once we are
able to adjust our ASCII codes properly,
most of the rest of the programming is
relatively straightforward, although
some complications arise from the
word wmp, backspace, and forward
space arrows. (The details of the pro-
gram will be given later.)
When it is all finished, the program
seems surprisingly complicated for
what it does. Is it worth it? I have found
the program quite useful for typing
routine letters that I did not need to
save to disk, or did not anticipate
editing. Since the format to be printed
is seen on the printer before it is used,
it is simple to adjust margins for nar-
row printing jobs, such as envelopes,
labels, and file cards. Perhaps the most
useful thing about the program is that
it forces you to imderstand how the
Apple keyboard and screen function. It
also illustrates the principle of how you
can have the computer do two different
tasks I typing and printing) at the same
time.
The next step in making this pro-
gram more useful is to convert it to
machine language so that it will run
faster and thus not slow down a fast
typist. This is left as an exercise for the
reader!
Program
Variables Used
S = screen start position; memory loca-
tion 1320 (mid-screen).
SI = screen cursor position; initialized
toS.
J = counter for screen column position.
Jl =end-of-screen column posi-
tion =39.
P = print buffer initial position = hex
300 or decimal 768 (alternate print buf-
fer position is hex 364 or decimal 868) .
Tl.= temporary print buffer location
(for alternating print buffer routine).
UC = upper case flag; initialized to zero
and set to 32 when "Escape" pressed.
AC = all caps flag; initialized to zero
and set to 32 when all caps called by
"control-A"; reset to zero when "all
caps" terminated by "control-S".
No. 38 -July 1981
MICRO - The 6502/6809 Journal
63
8045
PR#PN
8047
MARGIM-0
8050
X- PEEK (-16384)
8055
IF X=141 THEN GOTO 8400
8060
IF X"160 THEN GOTO 8200
8070
IF X=136 THEN GOTO 8300
8080
GOTO 8050
8200
POKE -16368, 0:A$=CHR$(32, 32)
8210
MARGIN=MARGIN-1
8220
PRINT AS;
8230
GOTO 8050
8300
POKE -16368,0:A$=CHR$(8,8)
8310
MARGIN=MARGIN-1
8320
PRINT A$;
8330
GOTO 8050
8400
POKE -16368,0
8405
IF HARGIN<40 THEN GOTO 8440
8407
TERM=1448+(MARGIN-40) '
8410
PRINT CHR$ (13,13), •
8420
PRiO
8430
RETURN
8440
TERM=1320+MARGIN
8450
PRINT CHR$(13,13); : PR#0; RETURN
F 1 = flag for use in alternating print buf-
fer routine; set alternately to or 1 at
each pass through the print routine.
Kl =flag working opposite Fl; set to
when Fl set to 1 and vice- versa.
B =bell counter for margin.
FL = flag to indicate character picked
from screen by forward or backspace is
upper case (inverse video); set to either
0or64.
LC = lower case flag for forward space
routine, for making character lower
case for the printer.
F = print flag; if set to 1 then a line is
being printed; reset to zero when print-
ing of line is finished (end-of-line flag is
reached).
T = temporary variable for switch
routines.
DS = double/ single space flag; set to 1
for single-space and 2 for double-space.
PI = print buffer current position; loca-
tion in print buffer where next
character will be POKEd.
R = counter for word- wrap.
TERM = terminus of printer line as
marked on screen; set to printer line
length of 60 characters by default; set
to selected right margin by subroutine
8000.
MARGIN = length of line coimter; set
by subroutine 8000.
I = general index counter for tab and
word- wrap functions.
Keyboard and Screen Codes Used
96 = flashing space on screen; cursor for
next character to be placed on screen.
129 = control -A; indicates to start all
caps; sets AC to 32 until a control - S is
typed.
136 = control - H; backspace arrow.
137 = control - 1; tab 5 spaces.
138 = control -J; tab 30 spaces.
141 = control -M; carriage return.
147 = control - S; end all caps; set AC
toO.
149 = control - U; forward space arrow.
1 54 = control -Z; quit program.
155 = Escape; next character is upper
case; sets UC to 32 for the next
character only.
219=ASCII screen code for vertical
bar.
255 = Hex FF; end-of-line flag for print
buffer.
Routines and Subroutines
Line 10: CHR$ function in Integer
BASIC.
Lines 11-80: initialization of variables.
Lines 100-300: read keyboard and print
line routines; if a line is being printed,
the keyboard may interrupt.
Line 110: read keyboard character.
Lines 120-200: check for keyboard con-
trol character.
Line 210: check to see if keyboard has
been pressed.
Line 220: check to see if print flag (F)
has been set, if not loop and read
keyboard again.
Lines 230-330: print routine; Line 240
checks for end-of-line flag (Hex FF or
decimal 255).
Line 1000: clear keyboard strobe.
Lines 1000-1170: screen and print buf-
fer business; adjust character for upper
or lower case, POKE to screen and print
buffer, advance counters, check for
margin and ring bell, loop to read
keyboard for next character.
Lines 2000-2070: printer business; sets
print flag (F) to 1, changes print buffer,
clears screen, resets cursor, resets end-
of-line signal.
Lines 3000-3120: Backspace functior
(back arrow on keyboard); reads screei
position at cursor and changes fron
flashing to normal or inverse, backs up
reads screen position backed up to
checks to see if character is inversi
video ( = cap) and sets FL to indicate
changes character picked up from nor
mal or inverse to flashing, returns t(
keyboard.
Lines 4000-4120: Forward space func
tion (forward arrow on keyboard); read
screen character, saves it for print bul
fer in T, changes from flashing to noi
mal or inverse, converts to prope
ASCn and POKEs into print buffei
moves forward (will not forward spac
past end-of-line set by Margin), set
next character to flashing and sets in
verse video flag (FL) .
Lines 5000-5590: Tab 5 function;
FOR-NEXT loop; puts normal space
(ASCn 160) on screen and normi
spaces (ASCn 32) in print buffer for th
next 5 spaces.
Lines 5500-5590: Tab 30 spaces.
Lines 6000-6190: Word-wrap functioi
If end-of-line reached (J = 39) on screei
then GOSUB 6000. Checks for wheth(
character at cursor position is a spac
(ASCn 160 or 96) . If not, backs up imt
it finds a space, counting the number i
positions backed up with R. When
finds a space it sets the screen positic
for output to the next line (with S -i- )
then moves forward on the previoi
line (with SI), picks up each charact
and transfers it to the next line. Clea
the end-of-line signal [vertical hs
from its initial location and moves
right the number of spaces printed <
the 2nd line. Resets SI to the next fr
screen location and returns.
Lines 7000-7050: program terminatii
routine; clears screen, reminds us
that DOS must be reinitialized fro
the keyboard, and quits.
Lines 8000-8450: Sets printer slot a:
margin.
Special Functions
X = PEEK ( - 16384) reads the keyboai
as the code of the key pressed is stor
in memory location - 16384.
POKE -16368,0 clears the keybo£
strobe. This must be done each tii
after the keyboard is read,
IF X > 127 : If a key is pressed, t
value at the keyboard memory locati
will be greater than 127 (high bit is se
iMCft
64
MICRO - The 6502/6809 Journal
No, 38 - July 1
OSI BONUS
A Typewriter Bell
for Your Microcomputer
This hardware and software
combination sounds an alarm
when you near the end of a
BASIC Input line. The hardware
can also be used to improve
game programs.
Charles L. Stanford
2903 Georgetown Road
Cinnanninson, New Jersey 08077
A wordprocessor, or even a simple
screen editor, can be a great aid in
writing articles and formatting text or
graphics printouts. But the lack of any
audible indication of line end can cause
many delays while letters or words are
moved down to the next line, or
hyphenated. Even programming in
BASIC can be substantially improved by
a "bell." For example, 1 like to cram as
much as possible into each DATA state-
ment line. So it's a real pain when I run
over the 72 character limit of the buffer,
and have to redo title whole line.
Luckily, Microsoft made it easy to
program a line position detector, by put-
ting vectors and flags in the first three
pages of RAM on most of their pro-
grams. Memory maps of PET, Apple,
Atari, OSI, and several others indicate
the presence of a "line buffer pointer."
Its location varies, but it is usually pretty
low in page zero. i3n the OSI, location
$000E holds the pointer to the next open
character space in the line buffer, which
happens to start at $0013. Thus, a tool is
available to check yoxir current location
while entering data, or printing to the
screen. But how do We access this infor-
mation and put it to use?
BASIC uses a routine located in the
monitor ROM at $FFBA to input a
character, whether from program
memory, the keyboard, or the ACIA.
i(^ While most such routines and sub-
I A routines are either not accessible, or
K^ must be reached by the USR function,
this particular one (along with a few
No. 38 -July 1981
others) is reached by BASIC via an in-
direct jump through RAM at $0218. So,
it's no real trick to "intercept" the
routine and use it for our bell. The
BASIC routiae shown in listing 1 does
just that.
Listing 1 shows a program which
will POKE a machine language program
into free RAM at the top of page zero.
Please note that while this RAM is not
used by BASIC, it is used by the
monitor, so a break and warm start will
require that the vectors in line 40 be
reset, and a break to the monitor will re-
quire that the entire program be re-
entered. Otherwise, once the program
has been run, NEW can be typed and the
computer is available for normal use.
Listing 2 shows the actual machine
language program. By changing the vec-
tors as we do in line 40 of listing 1, the
BASIC routine jimips to $00D8 instead
of to $FFBA. That, of course, has to be
done at some point, but we can use the
time for our own purposes. First, the
value of the data at location $000E is
loaded into the accvmiulator, and com-
pared with the desired location for the
bell to ring. This can be changed as you
desire; it is set as shown to ring at the
64th of the 72 characters. Next (and this
is optional) a solid square is POKEd to
the screen at the exact location of the
73rd character, to give a good visual in-
dication of the end of the line. I have
found this to be particvdarly useful for
BASIC programming, so that the lioe
can use every character possible.
Finally, we ring the bell. This is
done by setting two of the keyboard
rows located in memory location $DF00
to low. (Actually, while only two rows
need to go low, I just set all eight to zero.
This triggers a small oscillator which
will be described shortly.) The lines stay
low for only a few microseconds, until
the keyboard scan routine takes over
and sets all but one at a time back to
high. Thus, you get a visual and an audi-
ble warning when neaiing the end of the
line. It is also possible to trigger the bell
by monitoring the cursor location at
$0200, but then the CIP owner will get
a sound three times for each line, due to
the 24 character screen vddth.
The C2 user can make the change
easily. Other variations, such as PEEK-
ing the screen to see if the scarmed loca-
tion has a blank or a character, suggest
themselves. As my screen editor is for a
modified CIP with 64 characters, and is
written in machine language, I use a
variation of this method. With the cvir-
sor travelling from the upper left comer
of the screen, it is necessary to AND the
low byte of its location with #$3F to get
only the location in the line, rather than
the location in the page.
Circuit Description
The bell itself is a model of simpli-
city. Only two chips are required, and
both are readily available at Radio Shack
or similar stores. What we're doing is
using the keyboard as an output port.
The problem is that the keyboard scan
routine in the monitor also uses it as
both an output and an input port, and
continually switches the rows, and then
checks the columns for a key closiure.
The trick here is to use a combination of
rows, which the scan routine does not
do. Some programs must, as I get an
Listing 1
10
REM —BELL & MARK FOR 24 CHR OSI CIP
20
REM — C.L. STANFORD
30
REM
40
FOR X = 216 TO 235: READ D: POKE X,D: NEXT
50
POKE 536,216: POKE 537,0
60
mTh 169,64,197,14,208,10,169,161,141,124
70
DATA 211,169,0,141,0,223,32,186,255,96
MICRO - The 6502/6809 Journal
65
OSI BONUS
6i*pQ
itS** Tix/^
Figure 1: Schematic
ti
occasional odd ring. But this is very
seldom, and never occurs in such a way
as to interfere with its main function.
The detector IC is a quad dual input
NOR gate, and two of the four gates are
used. The first will go high only when
both inputs are low. Otherwise, its out-
put remains low. The second is wired as
an invertor to condition the signal for
the oscillator. That is an NE556 (the
dual 555 timer). Of course, two 555's
can be used just as well, but I wanted to
reduce package count to save space. The
front half of the 556 is wired as a
monostable multi-vibrator, and the R/C
combination used gives a tone duration
of about 1/5 of a second. The second
half of the 556 is on only while the out-
put of the first is high. It is wired as an
astable multi-vibrator with a frequency
of about IKHz. Its output is wired
directly to a small speaker through an
electrolytic capacitor and a low-value
resistor. The result is a sharp high-
pitched "beep" whenever the keyboard
rows go low.
Building the Bell Circuit
Generally, wire wrap is best for a
project of this size, although the Radio
Shack dual IC prototype board can be
used if a large enough case is selected.
Also, the speaker size will dictate other
dimensions to a certain degree. In other
words, select components which will fit
into your box! You can use either a
74LS02 for ICl as shown, or a CMOS
CD4001AE. If the CMOS chip is
chosen, change the 5K pullup resistors
to lOOK, and be sure to connect unused
inputs 5, 6, 8, and 9 to ground. Other-
wise, both will work fine, and the
CMOS design will use a fraction of the
power of the LS chip. None of the com-
ponents is critical, and substitutions can
be made within reason. Increasing the
value of either the resistor or capacitor
associated with pins 1 and 2 of IC2 will
result in a longer tone. Increasing those
connected to pins 8, 12, and 13 will
resvilt in a lower pitch.
Drill your case for a four-conductor
cable, and cut one to a suitable length.
The connector can be any of several,
depending on the configuration of your
computer. Superboard owners can just
use a Molex pin plug. ClP's need a bit
more sophistication. I had previously
brought all the rows and columns to the
front of my CIP on a DB25 (RS-232)
connector, so it was easy. A very good
plug and socket available everywhere is
the European DIN series. Mount the
socket carefully on either the front or
rear panels of your computer, and con-
nect to the main board at jack J4. Pins 1,
2, and 10 have rows 1, 7, and 6 respec-
tively; pick any two. You will have to
connect an additional wire to +5 volts
at any convenient location on the board.
There is a good ground location near the
jack.
Othei Applications
Shortly after building this add-on
circuit, I found a pretty nice Breakout
game written in BASIC for the CIP in a
magazine. Adding the bell was simple!
The program tested for the paddle,
walls, etc., with IF... THEN statements.
I just keyed "POKE 57088,0" within
each dependent statement line, and now
the "bell" rings every time the puct
hits any obstruction. The bell does noi
retrigger, as Control/C is not disabled,
and the keyboard scan is thus in con-
tinuous operation. If Control/C i;
disabled, a "POKE 57088,255" will b«
required to turn off the bell.
There is absolutely no reason this
circuit caimot be coimected to a port or
just about any computer. It will, o
course, be a lot harder to control if th(
BASIC interpreter does not have Micro
soft's vector format, but this little bit o
hardware eliminates the need to pro
gram the port to make the tone in rea
time; just POKE it on, POKE it off, anc
resume the program. micoo
Charles L. Stanford is a Civil Engineer,
has a PE license, and manages the
Facilities Department of Philadelphia's
transit system. He got into
microcomputing as a hobby from the
hardware side, designing toys and games
with chips, and bought a CIP about two
years ago. He has been "redesigning" bot
the hardware and software ever since.
Listing 2
;* BELL RINGER
LINLEN
EPZ
$0E
GETCHR
;
EQU
ORG
OBJ
$FF.BA
$D8
$800
00D8 A94a
'
LDA
#$40
;LINE LENGTH
OODA C50E
CMP
LINLEN
(CHECK IT
OODC DOOA
BNE
END
OODE A9A1
LOA
#$A1
;PUT A SQUARE ON
OOEO 8D7CD3
STA
$D37C
; SCREEN AT LINE END
00E3 A900
LDA
#$00
;RING THE BELL
GOES BDOODF
STA
$DFOO
00E8 20BAFF
END
JSR
GETCHR
;GET A CHARACTER
OOEB 60
RTS
66
MICRO - The 6502/6809 Journal
No, 38 -July 1981
^
■?->
OSI BONUS
^^^^^!
Monobyte
Checksum Dumper
for CI P
This two page machine
language dump/load utility
provides fast tape I/O and
checi(sum protection.
Peter D.H. Broers
Overijsselstr.9
5144 EH WAALWIJK
The Netherlands
This routine saves programs or data to
tape and uses $1E00-1FFF. When
relocated, locations 1E4F |1F) and 1E54
(00) have to be replaced by the high/low
bytes of the LOADER-start location
($1F00 here).
The routine is entered at $1EOO
(.lEOOG in monitor) and prompts
CHECKSUM DUMPER
FRST/LAST/AUTO ?
(first location, last+ 1 and
autostart)
waiting for 12 valid hex digits to be
typed in, (no conections, sorry); next it
prompts
START RECORDER
waiting for a carriage rettim from the
keyboard.
It then dumps a loader (IFOO-IFFF)
and next the program or data in blocks
of 256 bytes. The last block may be
shorter. The format is:
CR, ten zeroes, line feed (the car-
riage return is neglected)
; identifier of a block of data
0240 four bytes (hex address, ia
ASCn)
Listing 1
1
• If n
* SINGl£ BVTE OffiCKSUM DUMftIK *
.* *
.*
4
BY PETCR BROERS
*
*******************************
* DOMPER PART
*
BCTIN
BC3U $HFEB
;GET BXTE FKM TAPE OR KEYBOARD
ByiDOT B30 $FFEE
iDISPIAY (AMD SAVE) A BYTE
SAVBVT BQU $FCB1
;SAVE BYTE WITHOUT DISPLAY
ADBES
EPZ SEC
jADTOeERRT UXATICK
WD
EPZ ADRESf 2
•LAST LOCATICN TO BE DOMPKU
POTR
EPZ ADRES+4
;F1RST TfrATICN, CURRENT POINilSK
CHOC
EPZ ADHESt€
rCHBCKSUM (TWO BYTES)
CMTR
EPZ ADRESfS
.-OOanER (ONE BYTE)
LOADER BC30 SIFOO
ADCHCK BOO U»DB3H569
,-ADD BYTE TO CHEX3CSUM SOBR
ADRIM
BQO LaADERf$73
;GET ADOt IN HEX SUBROVmiE
PMIPTS BOO IX»DER4-?96
rPRINT MESSAGES SUBBDOTINE
lEOO
ORG $1E00
lEOO
CBJ $800
lEOO
lEOO A900 BESET
ILA #$00
1B02 850D
STA $0D
;IK>NUU£
1E04 A202
UK f$02
;PEIOT "DtM> B/M" (BASIC OR MACHINE)
1E06 20961F
JSR PRMPTS
1E09 2000FD
JBR $ETXX)
• GET KEY
LEOC CS42
CMP 'B
;IF KEY IS "B" THBl BASIC
lEOE D03A
ENE MAOQN
;EI£E MAOmilE UNGUNX PROGRAM OR EUMP
lElO
lElO A204 BASIC
LQC *$04
.-PRINT "READY 7"
1E12 20961F
JSR PRMPTS
1E15 2000FD
JSR ¥ilX)0
;GCT KEY
1E18 059
CMP 'Y
;IF KEY IS "Y" THEM PROfWD
lElA D0F4
EME BASIC
•ELSE REDO PBCMPT "READY?"
lElC 20F7FF
JSR $FFF7
;SAVE
1F.1F A207
UK #$07
.-PRINT ".0079/"; (BASIC POINIEBS START)
1E21 20961F
JSR PRMETS
1E24 A200
UK #$00
1E26 ;
lE2e
$79, 7A START-OF-BASIC
1E26 ;
$7B,7C QD-OF-BASIC
1E26 B579 I
OC^A
IXA $79,X
.-SAVE POINIEBS IN MaNTTOR U»DAHU=; FORM
1E28 20DF1E
JSRMJNOOT
1E2B E8
UK
1E2C C904
CMP #$04
1E?K D0F6
EKE liOOTA
1E30 A579
UA $79
,-SET START POIHIER TO DUMP THE COrTBUnS
1E32 A47A
UH $7A
.-OF THE BASIC STORT POINTER
1E34 85E4
STA PWTR
1E36 84E5
STVr PNTR+-1
1E38 A57B
IDA $7B
.-SET END PNTR OF DtWP TO OCWIHITS OF
1E3A A47C
U3Y $70
;THE BASIC EMD-OF-PBOG POINIER
1E3C 85E2
STA EMD
1E3E 84E3
Sry EMDt-l
1E40 A974
IHA #$74
.-SET AUTOSTAET ADISERS TO $A274
1E42 A0A2
lOT #$A2
; (BASIC WARM START)
1E44 85E0
STA ADRES
1E46 84E1
sn ADRES+1
1E48 D019
BNE EMPU»
:J«1P TO "IXM. IX3ADBK" icontinued)
No. 38 -July 1981
MICRO - The 6502/6809 Journal
67
OSI BONUS
counter (for a full block, or less,
for a shorter block (binary byte)
DATA (up to 256 bytes, no ASCII, no
masked off bits: full binary)
L a binary byte giving the
checksum low
H a binary byte giving the
checksum high
The checksum is the binary sum of
all the data bytes in the block; the
"household bytes" such as the CR,
zeroes and LF, identifier, address and
counter and the checksum itself, are not
included in the coimt.
After the last block, comes the
autostart: "$1300." When loaded, the
loader starts itself, and after the
checksum load is completed, the
machine goes to the autostart location,
which may be the entry point of the
routine or any other location.
At 300 bauds, the loader takes about
30 seconds to come in, and 10 seconds
for any page. (My 4.5K assembler loads
in about 3V4 minutes.) The MONITOR
"L" format (hex + carriage return) takes
about 9 minutes, and the hex-checksimi
format (OSI standard?) about the same
time. TTiere should be no problems at
600 baud or more, as long as the cassette
supports the higher baud rate.
The program might be shortened to
fit within one page if one does not use
the checksum control. I tried a
"monobyte dumper" without a check-
sum, and no blocks. The whole program
dumped one byte after the other, and it
worked all right. However, the time one
wins by this fastest possible dump is
very Uttle, as this checksvmi dxarnp takes
only 20 household bytes per page.
Peter Broers is a grammar school teacher
of French, and a member of the Dutch
province of Brabant Superboard Users
Group BRABOSI. He is trying to introduce
a small computer in the school for
computer class and administrational
services. His main interest lies in system
programs.
Listing 1 (Continued)
1E4A
.
1E4A A203
MACKtN IXK *$03
; PRINT"FIRSr/lASr/AUTO? "
1E4C 20961F
JSR PEMPTS
1E4F A005
my #$05
;GET 6 HEX (2 DIGITS EACH) ADKffiSSES
1E51 20731F
JSR ADKIN
;flND STORE THEM IN ADRES/EMD/POINi'EK
1E54 A204
IXK #$04
1E56 20961F
JSR PRMPTS
;PRINT "READY?"
1E59 2000FD
JSR sfdoo
;GEr KEY
1E5C C959
CMP 'Y
;IF KEY IS "Y" THEM PR(I(>J-D
1E5E DOEA
ENE MAOON
;ELSE RHX) PKCMPT "FIBST/LAST/AUTD?"
1E60 20F7FF
JSR $FEF7
;SAVE
1E63
;
1B63 A205
EMPLM) UK #$05
;DUMP THE LOADER IN "MSMl'lUR LGADABU:"
1E65 2CI961F
JSR PraffTS
:P0RMAT, PRINTING LOADER START ADDRESS
1E68 A200
UK #$00
;(".1F00/" AS SUPPLIED HEBE)
1E6A
;
1E6A BOUUIF
LOCPB UJA LQADER,X
;AND 256 ByitS AS 2 HEX DIGITS,
1E6D 20DF1E
JSRMOKXJT
;PUJS CARRIAGE REMURN
1E70 E8
OK
1E71 D0F7
WE LOCTO
1E73 A206
UK #$06
jPRINT THE LOADER SHJ-STRBT AM»ESS
1E75 20961F
JSR PRMPTS
;(".1F00G", AS SUPPT.TW) HERE)
1E78
;
1E78 A900
amwp u» #$00
1E7A 85E8
SIk CXfTR
ir7C 38
SBC
;CWjC NU4BER DF BYIES STIUi TO
1E7D A5E2
IDA EDD
;BE DCHE, USING CHBCysUM LOW RBGIfflER
1E7F E5E4
SBC PSTR
;T0 STORE THE LOW RESULT TBffiORARILY.
1E81 85Ee
STA CHCK
1E83 A5E3
U» aUDt-l
fCALCUIATE THE NUMBER OF PAGES
1E85 E5E5
SBC PHTRH
1BB7 3041
BM OFF
;IF OVER $7F. THEN READY (NEGATIVEl)
1EB9 DUC6
EME FITinCK
;IF NCT ZERO, THQI M»E WKUS PAGES
1E8B ASES
UA CHCK
;IF ZERO, THQ? RESET aXMER TO LOW
1E8D 85E8
STA CMTO
;RESULT (POSSIBLY USS THAN 256)
lEUi' F039
BBO OFF
• IF LOW RESULT ZERO, THEN BEADY & OFF
1E91
•
1E91 206rA3
nCXY. JSR $A86C
;PRIin> OR, 10 ZEBCES AMD LF
1E94 A93B
U» ';
; PRINT RTiOrK OTHTIFIHl
1E96 20EEIT
JSR B5fT0OT
1E99 A5E5
UlA POTTM-l
;SAVE BLOCK ADDR IN HEX FORMAT
1E9B 20E71E
JSR HEXDOT
1E9E A5E4
IXIA PtTTR
lERD 20E71E
JSR HEXOUT
1EA3 A5E8
UlA cxrm
.-SAVE THE CnVnER IN BINARY
1ER5 20B1FC
JSR SAVBOT
1EA8 AOOO
UK #$00
jRESET THE CHEX3CSUM TO ZEHD
lEAA 84Ee
STlf CHCK
lEAC 84E7
Sn CHC3?+1
lEAE
;
lEAE B1E4
UX)PC UA (PWrR),Y
;SAVE TOE BLOCK BYTE BY BYTE
lEBO 20B1PC
JSR SAVEVT
1EB3 20691F
JSR ADCHCK
;ADDING IT TO THE OffiCKSUM
1EB6 C8
INY
1EB7 C4E8
CPY CHTO
;IF RTinrK DCKE,
1EB9 D0F3
ENE UJOVC
lEBB ASES
UlA OTK
;THEN SAVE TOE CHECKSUM IN BINARY,
lEBD 20B1FC
JSR SAVBOT
;LOW FIRST, HICTI NEXT
lECO A5E7
UlA CHCK+1
1BC2 20B1PC
JSR SAVBYT
1EC5 E6E5
me PNTR4-1
;NEXT P«3E
1BC7 4C781E
JMP CHDCMP
;REDO THE WHCtE THING
IBCA
;
IBCA 206CA8
OFF JSR $A86C
rPROn- CR, 10 ZEBraS, AND LF
IBCE A924
u» •$
;PRINT TOE AUTOOTART IDENTIFIER "$"
UXT 20EEEF
JSR ByrouT
1ED2 A5E1
UA ADRES+1
jPRINT TOE AUTOSTART ADTOES IN HEX
1ED4 20E71E
JSRHEXDUT
1ED7 A5E0
UlA ADRES
1ED9 20E71E
JSR HEXDOT
lEDC 4C00FE
JMP $FEOO
;AND GO TO fOOTDR OR ANY LOCATICN
lEUF
•
lEOT 20E71E
MMBOT JSR HEXDOT
rSUBRDOTINE TO DUMP A BYTE AS
68
MICRO - The 6502/6809 Journal
No. 38 -July 198
OSI BONUS
Listing 2
3800
*
080O
* SINGLE-BYTE CHECKSUM DUMPER |
UHOO
*
0600
* LOADER pwrr
0800
*
0800 i
3YTIN
B3U SFFEU
GETT BYTE FRCM TAPE OR KEYED
0800 BYTOOT EQU jFt'Et
DISPIAY (AND SAVE) BYTE
0800 I
\DEES
EPZ $E0
CURRENT IfiCATICK
0800 1
3JD
EPZ MlRES+2
(mV USED IN LOADER)
0800 1
'OTR
EPZ WJRES+4
(NOT USED IN LOADER)
0800 (
3KK
EPZ W3RES+6
CHECKSUM
0800 (
2JTR
EPZ M)RES+8
COUNl'EK— NO. BYTES IN A BLOCK
0800
IPOO
ORG ?1FOO
IFOO
C£J $800
IFOO
IFOO 20F4FF Ii»DER JSR $FFF4
LCAD '
1F03 A20A LCBLCK UK #$QA
1F05 20EBFF ZBSOTO JSR BliTIN
VBUT FOR 10 ZEROES TO CC^E IN
1F08 D0F9
EKE IDRIiCK
IFOA CA
HEX.
IPOB D0F8
£ME ZEROTO
IPOD
IPOD 20EBFF LINEFD JSR BOTIN
WAIT FOR LINE HiED TO COME IN
IFIO C90A
CWP #$0A
1F12 D0F9
ENE LINEFD
1F14 20E0A8
JSR $A8E0
AND DISPIAY A SPACE
1F17
1F17 20EEFF
;DENr
JSR BYTDJ
VffilT FOR AN IDEOTIFIER BYTE
IFIA C924
CMP '$
IF IT IS '•$" THEM MnVfcTABT
IFIC F03D
BBQ WlWaT
IFIE C93B
CMP ';
IF IT IS ";" THEN LOAD A BLOCK
1F20 D0F5
ENE lEENT
ELSE WAIT
1F22
1F22 AOOl i
\DDR
LDY #$01
WAIT FOR 2 HEX BYTES (4 DIGITS)
(HIGH FIRST, LOW NEXT) , STORE IN "ADRES"
1F24 20731F
JSR W3RIN
1F27
1F27 20EBBT CNTRIN JSR BYTIN
CET COUNTER FRCM TAPE
1F2A 85E8
STA OJTR
1F2C AOOO
un #$00
RPRFT THE CHBCKSIW TO ZERO
1F2E 84E6
STY CHCK
1F30 84E7
snr CHCK+1
1F32
1F32 20EBFF MRINLP JSR ByriN
MAIN LOOP: HAVE A BYTE FRCM TAPE
1F35 91E0
STA (ADRBS),Y
AND STORE TO CURRENT IfXATICN
1F37 20691F
JSR ADCHCK
ADDINT, IT TO THE CHECKSUM
1F3A C8
nnr
1F3B C4EB
CPY CSTR
IF BLOCK DONE
1F3D D0F3
HNE MAINLP
1F3F 2QEBFF
31ECK
JSR BYTIN
GE:r TOE CHEKKSUM FRCM TAPE
1F42 C5E6
CMP CHCK
•LOW FIRST, OCMPARE IT WIIH THE CAIT
1F44 D007
ENE ERROR
OffiOCSUM DURING LOAD, IF <>,
1F46 20EEb'
JSR BYTIN
•THEN ERROR MESSAGE
1F49 C5E7
CMP CHCK+1
1F4B F0B6
BBQ LDRTCK
•IF =, THEN NEXT BLOCK
1F4D
1F4D A201
EliBOR
LEX *$01
;PRINr ERROR MESSME "ERBDR<<HIT G"
1F4F 20961F
JSR PRMPTS
1F52
1F52 2000FD \
(iAITG
JSR $FDOO
■WAIT FOR "G" (TIME TO REWIND)
1F55 C947
CMP 'G
1F57 D0F9
BNE WAITG
1F59 FOflB
BEQ LDRTOK
•AND LOAD NEXT BLOCK
1F5B
;
1F5B 20EEFF
HJTOST JSR BYTOUr
-AUTOSTART: DISPLAY "S"
1F5E AOOl
LDY #$01
;GET AUTOSTART ADI» FKW TAPE
1P60 20731F
JSR ADRIN
• (TWO BYTES AS 4 HEX DIGITS)
1F63 EE0302
INC $203
;CLEAR THE LOAD FLAG
1F66 fiTEOOO
JMP (ADRES)
1P69
;
1P69 18
RDCHCK CLC
;ADD THE BYTE TO THE CHECKSUM
(Continuedj
OHIO SCIENTIFIC
S-FORTH — a full implemen-
tation of Fig-FORTH including
editor, virtual disK sub-sys-
tem, and compatibility with
OS65D-3 on 5V4" or 8" disk.
$34.95.
Source listing $24.95.
Both for $49.95.
TOUCH TYPING MADE EASY
— 15 lesson set teaches you
to "touch type". Now also
available for the C1P. 8K.
$19.95.
TITANIC QUEST — a real time
search where you risk your re-
maining supplies to find the
Titanic. 8K. $6.95.
TEXT EDITOR — the best
screen text editor available for
OSI C4P, C8P disk systems.
$19.95.
Send for our FREE
software and hardware cata-
log. Includes photos and com-
plete descriptions of all game,
utility, and business software.
Aurora Software Associates
^ P.O. Box 99553
^d- Cleveland, Ohio 44199 1
aaaa (216) 221-6981
Our Hardware Catalog
lists the newest
hardware available on
the market. The
Industry is working
constantly to develop
new and better
hardware for the
6502/6809-based
systems and MICRO is
pleased to present
their products for your
information. (Please
see page 99 in this
issue.) If you have a
product to announce,
simply request an
announcement form
from our Hardware
Editor.
1
No. 38 -July 1981
MICRO - The 6502/6809 Journal
69
OSI BONUS
Charge MICRO
and MICRO Books!
MICRO now accepts
VISA and Mastercard.
Credit card holders
around the world can
now order subscriptions
and books by phone or
mail.
Call (617) 256-5515
between 9:00 A.M. and
5:00 P.M. and say
"Charge it!"
Or mall your order with
your credit card name,
number, and expiration
date to:
Order Department
MICRO
P.O. Box 6502
Chelmsford, MA
01824
International Orders
If you are outside the U.S.,
you may pay by;
1. VISA or Mastercard
or
2. International
Money Order
M/e no longer accept bank
drafts from foreign
banks— even if ttie funds
are drawn on an account
in a U.S. bank! The rising
bank charges now make
payment by this method
prohibitive.
Listing 2 {Continued)
lr«0 19EO0O
ORA ADRES,Y
1P83 99E000
STA ADRES.Y
1186 88
EEY
1F87 lOEA
BPL ADRIN
•RPm FOR Y+1 BYl'ES
1F89 60
RTS
1E8A
•
1F8A 20EBEF
DIGIN
JSE BOTIN
•GET CNE HEX DIGIT
1F8D 20EEFF
JSR BYTOUr
DISPMY IT
1F90 2093FE
JSR $FE93
TEST IT FOR VALID HEX AND MAKE BINARY
1F93 30F5
BMI DIGIN
0-15. IF NOT VALID, REDO.
1F95 60
RTS
1196
11% AOFF
PKMPTS Un #$FF
MESSAGE PRINl'EK "PRCMPTS"
1F98 C8
PLOOPA
INY
FIND MESSAGE NR. X
1F99 B9M:1F
IXIA MESSAG, Y
1F9C DOER
EHE PLOOPA
1F9E CR
DEX
1F9F Wi'l
EKE PUX3PA
IFAl C8
PIJOOPB
nnr
AND PRINT (S, SAVE?)
1FA2 B9AE1F
LEA MESSAG.Y
1FA5 F006
BED REMJRN
1FA7 20EEFF
JSR BYTOOT
IFRA 4CA11F
JMP PLOOPB
IFAD 60
REIURN
RTS
IFRE
■
IFAE 00
MESSAG
BYT 00
MESSAGE
lERF
;
IFAF 455252
MESSA
ASC 'ERROR << HIT G'
;ERRDR MESSAGE
1FB2 4F5220
1FB5 3C3C20
1FB8 484954
IFBB 2047
IFBD 00
BYT 00
DURING THE LOADING
IFBE
;
IFBE OAOD
MISSB
HEX OAOD
MESSAGE 2— MESSAGE WHHJ
IFCO 44554D
ASC 'DUMP B/M'
STARTING TOE EtJMPER
1K:3 502042
1PC6 2F4D
1EC8 00
BYT 00
1FC9
;
1FC9 OAOD
MESSC
HEX OAOD
MESSAGE 3— ASKING FOR
IPCB 465253
ASC 'FRSr/LAOT/AUTO?
;THE ADDRE&S.SES
IPCE 542F4C
IFDl 415354
iro4 2F4155
in;7 544F3F
IFDA OAOD
HEX OAOD
IFDC 00
BYT 00
iroD
;
IHJD OAOD
MESSD
HEX OAOD
MESSAGE 4— ASKING FOR A "Y"
IFDF 524541
ASC 'READY ?'
WHHJ READY TO DUMP
1FE2 445920
1FE5 3F
1FE6 00
BYT 00
1F6A 65E6
ADC CHCK
1P6C 85E6
STA CHCK
1F6E 9002
BCC *+4
1F70 E6E7
INC CHCK+1
|1F72 60
1F73
ETS
;
1F73 208A1F
ADKDJ
JSR DIGIN
GET 2 HEX DIGITS
1F76 OA
ASL
AND CALCUIATE BYTE, STORING IT
1F77 QA
ASL
IN LOCATICK "ADRES+Y"
1F78 OA
ASL
1F79 OA
ASL
1F7A 99E000
STA ADRES.Y
IF7D 208A1F
JSR DIGIN
MICRO
MICRO - The 6502/6809 Journal
No. 38 -July 198
§ GRAPHICS
FOR OSI COMPUTERS
iV You Can Produce The Images
Shown Or Yours And Program
Motion With Our 256 By 256 High
Resolution Graphics Kit. ^_
Thats 65,536 Individually Controlled
Points On Your TV Screen.
^ Increase Column/Line Display.
You Can Set Up Your Own Graphic
Pixels Including Keyboard Characters
And Unlimited Figures. ^
i^ This Kit Includes All Parts, Software
g^ And Assembly Instructions Required
To Get Up And Running.
The Included 8k Of 2 1 1 4 Memory
Is Automatically Available When
Not Using The Graphics.
Boot Up And See 8k More Memory.
i^ Adding The Kit Does Not Affect
Your Existing OSI Graphics.
Use Both At The Same Time
Or Separately.
it Buy The Entire Kit,
Including Memory, For $185.00
Or A Partial Kit For Less If You
Have Parts. Board And
Instmctions $40.00. Instructions
I Include Software.
^
ME
Z lom
sin
an
For This Kit Or A Catalog
Of Other Kits, Software
And Manuals Call Or Write:
MITTENDORF ENGINEERING
905 Villa Neuva Dr.
Litchfield Park, Az. 85340
(602)-935-9734
OSI BONUS
Line Editor
for OSI 540 Board
The program presented here
allows elementary line editing
functions for OSI computers
using BASiC-in-ROIM. The reader
can expand the program as he
feels is necessary to Include
more advanced features, such
as insert and delete.
E.D. Morris Jr.
3200 Washington
Midland, Michigan 48640
Users of OSI computers are painfully
aware that if a mistake is discovered in
the 63rd character of a BASIC line, the
entire line must be retyped. I have
watched in awe as PET owners zip the
cursor across the screen and correct the
offending character in a few keystrokes.
OSI machines lack this very useful
feature as standard equipment. However
don't despair, this article describes a
software patch to allow line editing on
OSI machines using the 540 video board
and BASIC-in-ROM. The program pro-
vides the basic editing functions, but the
user can add additional features as he
wishes. The technique can also be
appUed to the CIP, subject to limita-
tions discussed later.
A line editor must perform three
functions. First it must find the line to
be edited, then make the changes, and
finally put the line back into the BASIC
program. Finding the line is easy, just
LIST it. The data is then on the screen.
The line editor can read a character from
the screen, copying it exactly, whenever
a designated key is hit. If any other
character is typed, that character is in-
serted into the new line instead of the
screen character. Now comes the hard
part: How do you get the line back into
BASIC?
The new line must be inserted at the
proper location, moving the rest of the
program and refixing all the pointers.
This is exactly the job done by the
BASIC input routines. The line editor
can be much simpler if BASIC can be
fooled into beUeving that you re-typed
the entire line.
Let us first examine the workings of
the BASIC input routines. After cold
starting BASIC, try typing in the follow-
ing line
10ABCDE
If you press RETURN, this line will be
entered into the BASIC text. However,
instead of RETURN, press the BREAK
key and jump to the machine monitor
mode. Examine the data stored at loca-
tions $0013 to $0019. You should find
Location
Data
Ascn
$0013
31
1
$0014
30
$0015
41
A
$0016
42
B
$0017
43
C
$0018
44
D
$0019
45
E
The data at these locations is the hex
representation of the ASCII characters
you just typed. Locations $0013 through
$005A are the input buffer. Thus to
simulate keyboard input, the line editor
must store the corrected line in this buf-
fer. The next trick is to get BASIC to
accept this data. First the "X" and "Y"
registers must be set to point at the
input buffer and then a jvunp made to
the proper location in BASIC.
Try the following experiment. Cold
start BASIC, then jump to the machine
monitor. Using the monitor, fill loca-
tions $0013 to $0019 with the hex data
from the above example adding a $00 at
location $001A. Again using the
machine monitor, write the following
program at $0250.
$0250 A2 12 LDX #$12
$0252 AO 00 LDY #$00
$0254 4C 80 A2 JMP $A280
Then execute the program starting at
$0250. The pointers are set to the input
buffer, then a jimip is made into ROM.
There will be no indication that
anything happened, but you are now
back in BASIC. Type LIST and
10ABCDE
wUl appear. This technique has con-
vinced BASIC to accept a line of data
stored in the input buffer as if it had
been typed in. Try using this method to
input other lines of data, remembering
to make the final character a null or $00.
The final link to writing a line editor
is now at hand. Following is a listing of
an editor assembled at address $0240.
The program assiune? that the line to be
edited has been previously listed and
now appears on the screen starting at
$D641. The line editor is called through
the USR function. After clearing several
screen locations, the program displays
an "up arrow" ($5E) as a cursor im-
mediately below the line to be edited.
The subroutine at $FFEB gets a
character from the keyboard. If this
character is a "space bar" ($20), one
character is copied from the old line into
the input buffer and displayed on the
screen below the cursor. The cursor will
move backwards on a "backspace" or
$5F input. A RETURN or $0D indicates
that you are finished editing that line.
Since the space bar is used for direct
copying, something else must be used
for a "space". I have chosen the "#"
sign or $23. Any other character typed is
assumed to be corrected input, and is
stored in the buffer and on the screen.
The RETURN key causes the pro-
gram to display "OK" and places a null
at the end of the input line. The pointers
are set as described above, and a jump
made back into BASIC.
If the program is moved to reside in i
different memory location, the jumj
absolute instmctions at lines $0282 anc
$0288 must be changed.
72
MICRO - The 6502/6809 Journal
No. 38 -July 1981
OSI BONUS
For those of you who are not into
machine code, I have included a BASIC
program to set up this patch and then
erase itself. Once the line editor is
entered, either by BASIC or via machine
code, load the program you wish to edit.
Then add the following line to your
BASIC program:
1 POKE 11,64: POKE 12,2:
Z=USR(1)
LIST the line you wish to edit, then type
RUN. This will call the line editor and
display the cursor directly under the
listed line. The various valid commands
were listed above. To run your program,
either delete line one or enter RUN 10
jassuming your first line is 10). Before
saving the corrected program, delete
line one.
Now for the limitations of this sim-
ple editor. The line to be corrected must
appear at a fixed position on the video
screen. This is determined by the screen
read instruction LDA $D641,X. The
editor will not work if the line is not
exactly at this position. For example, if
a line is longer than 64 characters, the
screen will scroll, moving the text up
one line. A similar problem occurs when
attempting to edit the last line of a pro-
gram: the listed line appears too low on
the video screen. In this case simply hit
a RETURN to scroll up one line, and
then type RUN to enter the editor.
Lines longer than 64 characters can
be edited by changing the screen read
instruction from LDA $D641,X to
LDA $D601,X. This is accomplished by
using different keys for the "copy' ' func-
tion, depending on the length of the line
being edited. Lines shorter than 64
characters are copied by pressing the
space bar. Longer lines are copied with
the exclamation [!) key.
This editor can be modified to run on
a CIP or Superboard by changing the
appropriate screen locations. A BASIC
listing of a CIP version is also given
below. The editor is limited to a single
video line, which, in the case of the
CIP, is only 25 characters. In order to
edit multiple lines, the editor must be
able to skip over the unused bytes on the
edges of the CIP video screen.
jMcao
I
Listing 1
;*
;* LINE EDIT FOR OSI 540 BOARDS
• *
0240
/"
ORG S240
0240
0240
f
0240 A920
UA *$20
0242 A280
LDX l$80
0244 9DC0D6
CLR
STA $D6C0,X
; CLEAR SCREEN BOTTCM
0247 CA
DEX
0248 lOFA
BPL CLR
024A A200
LDX #$00
024C A920
CUR
LDA #$20
;RQ10VE CURSOR
024E 9D80D6
STA $D680,X
0251 9D82D6
STA $0682, X
0254 A95E
LDA tSSE
jCURSOR
0256 9D81D6
STA $D681,X
; PLACE CURSOR
0259 20EBFF
JSR $FFEB
;GET KEY STROffi
025C C920
CMP #$20
; SPACE BAR FOR SHORT LINE
025E F019
BBQ COPY
0260 C921
CMP #$21
; EXCLAMATION FOR LCMG LINE
0262 FOXO
BBQ UNG
0264 C90D
CMP #$0D
.-RETURN
0266 F023
BEQ DONE
0268 C95F
CMP #$5F
.-BACKSPACE
026A F019
BEQ BACK
026C C923
CMP #$23
;# FOR SPACE
026E DOOC
BNE WSCR
;MUST BE CORRECTICN
0270 A920
LEA #$20
; SPACE
0272 D008
BNE WSCR
;AI«AYS
0274 BD01D6
LCNG
LDA $D601,X
;READ SCREEN (LONG)
0277 D003
BNE WSCR
;AIMAYS
0279 BD41D6
copy
LDA $0641, X
;READ SCREEN (SHC»T)
027C 9DC1D6
WSCR
STA $D6C1,X
.-WRITE SCREEN
027F 9513
STA $13,X
.-INPUT BUFFER
0281 E8
LI
INX
0282 4C4C02
JMP CUR
0285 CA
BACK
DEX
,-BACK-SPACE
0286 30F9
BMI LI
.-LIMIT BACK SPACE
0288 4C4C02
JMP CUR
028B A900
DCHE
LDA #$00
028D 9513
STA $13,X
.-NULL INTO BUFFER
028F A992
LDA #S92
0291 AOAl
Wi #$A1
0293 20C3A8
JSR $A8C3
.-DISPLAY "OK" MESSAGE
0296 A212
LDX #$12
0298 AOOO
LDY #$00
029A 4C80A2
JMP $A280
,-BACK TO BASIC
Listing 2
10 PRINT
"LINE
EDITOR FOR OSI
CIP OR SUPERBOARD"
80 FOR I
= 576
TO 668: READ J:
POKE I, J: NEXT
90 NEW
100 DATA
169,32
,162,128,157,192,214,202,16,250 |
110 DATA
162,0,
169,32,157,128,
214,157,130,214
120 DATA
169,94
,157,129,214,32,235,255,201,32
130 DATA
240,25
,201,33,240,16,
201,13,240,35
140 DATA
201,95
,240,25,201,35,
208,12,169,32
150 DATA
208,8,
189,1,214,208,3,189,65,214
160 DATA
157,193,214,149,19,232,76,76,2,202
170 DATA
48,249
,76,76,2,169,0,
149,19,169
180 DATA
146,160,161,32,195,168,162,18,160,0 |
190 DATA
76,128
,162
No. 38 -July 1981
MICRO - The 6502/6809 Journal
73
T
OSI BONUS
OSI
AARDVARK
NOWMEANSBUSINESS!
OSI
WORD PROCESSING THE EASY WAY-
WITHMAXI-PROS
This is a line-oriented word processor de-
signed for the office that doesn't want to send
every new girl out for training in how to type a
letter.
It has automatic right and left margin justi-
fication and lets you vary the width and margins
during printing. It has automatic pagination and
automatic page numbering. It will print any text
single, double or triple spaced and has text cen-
tering commands. It will make any number of
multiple copies or ch'ain files together to print an
entire disk of data at one time.
MAXI-PROS has both global and line edit
capability and the polled keyboard versions
contain a corrected keyboard routine that make
the OSI keyboard decode as a standard type-
writer keyboard.
IVIAXI-PROS also has sophisticated file
capabibilities. It can access a file for names and
addresses, stop for inputs, and print form letters.
It has file merging capabilities so that it can store
and combine paragraphs and pages in any order.
Best of all, it is in BASIC (0S65D 51/4" or
8" disk) so that it can be easily adapted to any
printer or printing job and so that it can be sold
for a measly price.
MAXI-PROS -$39.95
THE EDSON PACK
ALL MACHINE CODE GAMES
F0RTHE8KC1P
INTERCEPTOR —You man a fast interceptor
protecting your cities from Hordes of Yukky
Invaders. A pair of automatic cannon help out,
but the action speeds up with each incoming
wave. It's action, action everywhere. Lots of
excitement! $14.95
MONSTER MAZE - An Arcade style action
game where you run a maze devouring monsters
as you go. If one sees you first, you become
lunch meat. Easy enough for the kids to learn,
and challenging enough to keep daddy happy.
$12.95
COLLIDE — Fast-paced lane-switching excite-
ment as you pick up points avoiding the jam
car. If you succeed, we'll add more cars. The
assembler code provides fast graphics and smooth
action. $9.95
SPECIAL DEAL-THE ENTIRE EDSON PACK-
ALL THREE GAMES FOR $29.95
THE AARDVARK JOURNAL
FOR OSI USERS - This is a bi-monthly
tutorial journal running only articles about OSI
systems. Every issue contains programs custom-
ized for OSI, tutorials on how to use and modify
the system, and reviews of OSI related products.
In the last two years we have run articles like
these!
1) A tutorial on Machine Code for BASIC
programmers.
2) Complete listings of two word processors
for BASIC IN ROM machines.
3) Moving the Directory off track 12.
4) Listings for 20 game programs for the OSI.
5) How to write high speed BASIC — and
lots more —
Vol. 1 (1980) 6 back issues - $9.00
Vol. 2 (1981) 2 back issues and subscription for
4 additional issues - $9.00.
ACCOUNTS RECEIVABLE - This program
will handle up to 420 open accounts. It will age
accounts, print invoices (including payment
reminders) and give account totals. It can add
automatic interest charges and warnings on late
accounts, and can automatically provide and cal-
culate volume discounts.
24K and 0S65D required, dual disks recom-
mended. Specify system.
Accounts Receivable. $99.95
* * • SPECIAL DEAL - NO LESS! * * *
A complete business package for OSI small
systems - (CI, C2, C4 or C8). Includes MAXI-
PROS, GENERAL LEDGER, INVENTORY,
PAYROLL AND ACCOUNTS RECEIVABLE -
ALL THE PROGRAMS THE SMALL BUSI-
NESS MAN NEEDS. $299.95
P.S. We're so confident of the quality of these
programs that the documentation contains the
programmer's home phone number!
SUPERDISK II
This disk contains a new BEXEC* that boots
up with a numbered directory and which allows
creation, deletion and renaming of files without
calling other programs. It also contains a slight
modification to BASIC to allow 14 character
file names.
The disk contains a disk manager that con-
tains a disk packer, a hex/dec calculator and
several other utilities.
It also has a full screen editor (in machine
code on C2P/C4)) that makes corrections a snap.
We'll also toss in renumbering and program
search programs — and sell the whole thing for —
SUPERDISK II $29.95 ( 5 1/4") $34.95 (8").
ANDFUN,
TOO!
BOOKKEEPING THE EASY WAY
-WITH BUSINESS!
Our business package 1 is a set of programs
designed for the small businessman who does not
have and does not need a full time accountant
on his payroll.
This package is built around a GENERAL
LEDGER program which records all transactions
and which provides monthly, quarterly, annual,
and year-to-date PROFIT AND LOSS statements.
GENERAL LEDGER also provides for cash
account balancing, provides a BALANCE SHEET
and has modules for DEPRECIATION and
LOAN ACCOUNT computation.
GENERAL LEDGER (and MODULES) $129.95.
PAYROLL is designed to interface with the
GENERAL LEDGER. It will handle annual
records on 30 employees with as many as 6
deductions per employee.
PAYROLL- $49.95.
INVENTORY is also designed to interface with
the general ledger. This one will provide instant
information on suppliers, initial cost and current
value of your inventory, it also keeps track of the
order points and date of last shipment.
INVENTORY- $59.95.
GAMES FOR ALL SYSTEMS
GALAXIAN - 4K - One of the fastest and finest
arcade games ever written for the OSI, this one
features rows of hard-hitting evasive dogfightinj
aliens thirsty for your blood. For those whc
loved land tired of) Alien Invaders. SpecifN
system — A bargain at $9.95
MINOS - 8K - — Features amazing 3D graphics
You see a maze from the top, the screen blanks
and when it clears, you are in the maze at groun<
level finding your way through on foot. Rea!isti<
enough to cause claustrophobia. — $12.95
NEW -NEW -NEW
LABYRINTH - 8K - This has a display back
ground similar to MINOS as the action take
place in a realistic maze seen from ground level
This is, however, a real time monster hunt as yc
track down and shoot mobile monsters on fool
Checking out and testing this one was the mos
fun I've had in years! - $13.95.
TIME TREK - 8K - Real Time and Real graphic
Trek. See your torpedoes hit and watch yoi
instruments work in real time. No more ui
realistic scrolling displays! — $9.95
SUPPORT ROMS FOR BASIC IN ROM M;
CHINES - C1S/C2S. This ROM adds line ed
functions, software selectable scroll window
bell support, choice of OSI or standard keyboar
routines, two callable screen clears, and softwai
support for 32-64 characters per line videi
Has one character command to switch mod
2 C1P from 24 to 48 character line. When ii
stalled in C2 or C4 IC2S) requires installatic
of additional chip. C1P requires only a jump
change. - $39.95
C1E/C2E similar to above but with extends
machine code monitor. — $59.95
OSI
Please specify system on all orders
This is only a partial listing of what we have to offer. We now offer over 100 programs, data sheets, ROMS, and boards
for OSI systems. Our $1.00 catalog lists it all and contains free program listings and programming hints to boot.
AARDVARK TECHNICAL SERVICES, LTD.
2352 S. Commerce, Walled Lake, Ml 48088
(313)669-3110
OS
pi '
74
MICRO - The 6502/6809 Journal
No. 38- July 1!
OSI BONUS
I
In a
Life
Wrap-around
Universe
A novel variation on the oldest
computer game of all.
Paul Krieger
3268 S. Cathay Cr.
Aurora, Colorado 80013
Ever wonder what would happen if your
gliders could soar for a 1000 generations?
Where does a puffer train go? Here is a
wraparound version of John Conway's
cellular automata "LIFE."
Life is normally limited to a fairly
small grid of squares where patterns run
out of space after only a few generations.
In this version it is a string of 1024 cells
so a pattern going off either side of the
screen will re-appear at the other.
By testing the first 3 bits of the 4th,
8th, and 12th bytes, a matrix is created
and the standard rules of LIFE are ap-
plied. The 1st 3 bits of byte 4 are
numbered 1,2,3. The 1st 3 bits of byte 8
are nimibered 4,5,6 and the 1st 3 bits of
byte 12 are 7,8, and 9. CeU 5 is the sub-
ject cell.
First, the program counts the
number of bits (except for #5] that are
" 1 . " Then bit 5 is tested to determine if
it is on or off. If bit 5 is on and there
were exactly 2 or 3 cells on, it is left on.
If there were not, cell 5 is set to zero. If 5
was not on and exactly 3 of the other
cells were on, it is set on.
Once the cells have been coimted
and set the 128 bytes are shifted 1 bit
left, and the process continues again un-
til all 128 bytes have been tested. As
they are set, the bits being set are
transformed into bytes on the screen so
8|kthat at this point, they must be copied
Pback to the bit list before the entire pro-
cess begins once again.
No. 38 -July 1981
Main Program
4 REM
5 REM VIRTUAL LIFE
6 REM BY PflUL<KRIBGER
7 REM
10
QOSUB 1400
15 Q = 111 1
20
PRINT "INSTRUCTIONS"
24
PRINT
25
PRINT "THIS PROQWM CREATES"
26
PRINT "A SIMUIATIO? OF"
27
PRTWr "nNF fTTLFn T.TPF. "
28
PRIOT "ENTER A PATTEFN"
29
PRINT "OF CEIJS TO START. "
30
PRINT "CURSOR OCMKaS" : PRINT
31
PRINT "0=*P, P=RIGHr"
35
PRINT "K=LEPr, L=DOWN"
40
PRINT "J=ERASE,I=CENIER"
50
PRINT "-t-EEPOSIT CFTI,"
55
PRIOT "E!=GENERATE CFTIS": PRIOT "T=END PROGRAM"
60
PRIOT
70
PRIOT "TYPE 'R' TO CCOTINUE"
95
INPUT A$: GOSUB 1400
130
INPUT "(R)ANDCM OR (P)IAN";A$
131
IF LEPr$ (A$,l) = "R" THEN 200
132
GOSUB 1400
134
S = 53775
135
PCKE 8,43: GOSUB 1500
136
PCXCE 11,00: REM LCW Ufci'l'lNATICN
137
PCKE 12,25: REM HLGH, =$1900
138 Q = USR (Q) : GOlO 2100 |
139
.REM 2100 IS PAUSE BEnWEEN SCRF^iNS
140
REM 138--G0T0 GENERATE CKTJB
200
PRIOT : PRIOT "eOH MANY CKTIS"
205
PRIOT "SECULD I GEWERATE";
210
INPUT E
240
GOSUB 1400
250
FOR C = 1 TO E
260
D = lOT (1024 * RND (1) + 1)
270 D = D + 53379 |
280
PCKE D.Q
290
NEXT C
300
GOTO 136
1399
REM a.RAR SCREEN SUBROUTINE
1400
PCKE 11,237
1410
PCaCE 12,25: REM SETUP $19ED
1420 Q = USR (Q) 1
1430
RE7IURN
1499
REM TEST CURSOR KEYS
1500
PCKE 530,1
15i0 K = 57088 |
1520
POKE K,223
1530
IF PEEK (K) = 191 THEN 1830: REM L.DOWN
1540
IF PEEK (K) = 223 THEN 1870: REN 0,UP
1550
PCKE K,247
1570
IF PEEK (K) = 251 THEN 1920: REM J, ERASE
1580
IF PEEK (K) = 253 THEN 1940: REM K,LKET
1590
PCKE K,253
MICRO - The 6502/6809 Journal
75
OSI BONUS
1600
1610
1620
1640
1645
1650
1660
1670
1799
1800
1810
1820
1825
1830
1840
1850
1860
1870
1880
1890
1895
1920
1930
1940
1950
1960
1970
1980
1990
2000
2010
2020
2035
2040
2099
'2100
2110
2115
2116
2120
2125
2130
2140
2150
2160
2170
2180
2190
2200
2990
2991
2992
2993
2994
2995
3000
3010
3020
3030
3040
3050
3060
3070
3080
3065
3090
3100
3110
= 253 1HEN 1980: REM
= 251 IHEN 2020: REM
= 253 THEN 1800: REM
= 191 1HEN 1660: REM
IF PEEK (K)
IF PEEK (K)
POKE K,239
IF PEXK (K)
IF PEEK (K)
GOTO 1520
VOKE 530,0
RETURN
REM PESEOFM SCREEU GCf*1ANI)S
IF PEEK (S) < > Q THEN POKE S,32
S = 53775
IF PEEK (S) < > Q THEN PCKE S,43
GOTO 1510
IF PEEK (S) < >
S = S + 32: IF S >
IF PEEK (S) < >
GOTO 1510
IF PEEK (S) < >
S = S - 32: IF S <
< >
,P, RIGHT
+, DEPOSIT
CENTER
GENERATE
Q THEN PC»<E S,32
54171 THEN S = S -
Q THEN POKE S,43
Q THEN POKE S,32
53379 THEN S = S +
Q THEN POKE S,43
800
800
> Q THEN POKE S,32
< 53379 THEN S = 54171
> Q THEN POKE S,43
> Q THEN POKE S,32
> 54171 THEN S = 53379
> Q THEN PC»<E S,43
IF PEEK (S)
GOTO 1510
POKE S,32
GOTO 1510
IF PEEK (S)
S = S - 1: IF
IF PEEK (S)
GOTO 1510
IF PEEK (S)
S = S + 1: IF
IF PEIK (S)
GOTO 1510
PCKE S,Q: GOTO 1510
IF Q > 255 THEN Q =
GOTO 1510
REM OOUWT CYCLES, PAUSE BETIWEEN SCREENS
PRINT "CYCLE" ;Cy
CY = CY + 1
REM INSERT "GOTO 2170" HERE
REM IF YOU DON'T WANT TO STOP
POKE 530,1
K = 57088
Pa<E K,239
IF PEEK (K) = 191 THEN 2170: REM "E"
IF PEEK (K) = 239 THEN END : REM "T"
GOTO 2125
PCKE 11,46
PCKE 12,25:
Q = USR (Q)
Qcrro 2100
REM STORES OR READS MACHINE LANGUAGE
REM SUBROUTINE: REM NOTE ***
REM V«EN SAVING TO OSI TAPE YOU MUST
REM TYPE "RUN 3000" AFTER BASIC
REM "CK". CN LOAD, MACHINE WILL
REM PERFORM THIS EUNCTICN FHCM TAPE
IF PEEK (515) = 255 THEN 3070
FOR X = 6400 TO 6656: REM IBCIMAL OF MAC CD
K = raEK (X)
PRINT K
NEXT X
END : REM END OF CODE TO COPY MACH TCTAPE
REM ROUTINE TO READ MACHINE CODE FRCM TAPE
EDR X = 6400 TO 6656
INPOT K
POKE X,K
NEXT X
PC«E 515,0
END
REM TO $192E
This is a hybrid program for the Ohio
Scientific CIP with 8K of memory, writ-
ten in both Microsoft BASIC and
machine language. Since no page zero
processing is done it should be fairly
easy to convert it to any 6502 computer.
Key in the following machine
language code using your monitor.
Then you can save both the BASIC and
the machine code with the SAVE/LIST,
as though it were a BASIC program.
While the tape is still running, and
after the BASIC portion has finished,
type "RUN3000 return."
Copy
screen to matrix subroutine.
1900-
A9
DO
LDA
#$D0
1902-
8D
OC
19
STA
$190C
1905-
D8
OLD
1906-
AO
04
LDY
#$04
1908-
A2
00
LDX
#$00
190A-
BD
00
D3
LDA
$0300, X
190D-
C9
20
CMP
#$20
190F-
FO
08
BEQ
$1919
1911-
AD
04
18
LDA
$1804
1914-
09
80
ORA
#$80
1916-
40
IE
19
JMP
$191E
1919-
AD
04
18
LDA
$1804
191C-
29
7F
AND
#$7F
191E-
8D
04
18
STA
$1804
1921-
20
C2
19
JSR
$19C2
1924-
E8
INX
1925-
DO
E3
BNE
S190A
1927-
EE
OC
19
INC
$190C
192A-
88
DEY
192B-
DO
DD
BNE
$190A
Test and set cells.
Move result to screen
192D-
60
RTS
192E-
A9
DO
LDA
#$D0
1930-
8D
9A
19
STA
$199A
1933-
AO
04
LDY
#$04
1935-
4C
3E
19
JMP
$193E
1938-
EA
NOP
1939-
EA
NOP
193A-
EA
NOP
193B-
EA
NOP
193C-
EA
NOP
193D-
EA
NOP
193E-
A2
21
LDX
#$21
1940-
A9
00
LDA
#$00
1942-
8D
00
18
STA
$1800
1945-
A9
20
LDA
#$20
1947-
2C
04
18
BIT
$1804
194A-
08
PHP
194B-
10
03
BPL
$1950
194D-
EE
00
18
INC
$1800
1950-
28
PLP
1951-
08
PHP
1952-
50
03
BVC
$1957
1954-
EE
00
18
INC
$1800
1957-
28
PLP
1958-
FO
03
BEQ
$195D
195A-
EE
00
18
INC
$1800
195D-
A9
20
LDA
#$20
195F-
2C
08
18
BIT
$1808
1962-
08
PHP
1963-
10
03
BPL
$1968
1965-
EE
00
18
INC
$1800
1968-
28
PLP
1969-
FO
03
BEQ
$196E
196B-
EE
00
18
INC
$1800
196E-
A9
20
LDA
#$20
1970-
20
OC
18
BIT
$1800
1973-
08
PHP
1974-
10
03
BPL
$1979
1976-
EE
00
18
INC
$1800
1979-
28
PLP
H' ."I
76
MICRO - The 6502/6809 Journal
No. 38- July 198
I
197A-
06
PHP
197B-
50
03
BVC
$1980
197D-
EE
00
18
INC
$1800
1980-
28
PLP
1981-
FO
03
BEQ
$1986
1983-
EE
00
18
INC
$1800
1986-
2C
08
18
BIT
$1808
1989-
50
18
BVC
$19A3
198B-
AD
00
18
LDA
$1800
198E-
C9
02
CMP
#$02
1990-
30
OC
BMI
$199E
1992-
C9
04
CMP
♦ $04
1994-
BO
08
BCS
$199E
1996-
A9
6F
LDA
#$6F
1998-
9D
00
D4
STA
$D400,X
199B-
4C
AD
19
JMP
$19AD
199E-
A9
20
LDA
*$20
19A0-
4C
98
19
JMP
$1998
19A3-
AD
00
18
LDA
$1800
19A6-
C9
03
CMP
*$03
19A8-
FO
EC
BEQ
$1996
19AA-
4C
9E
19
JMP
$199E
19AD-
20
C2
19
JSR
$19C2
19B0-
E8
INX
19B1-
FO
03
BEQ
$19B6
19B3-
4C
40
19
JMP
$1940
19B6-
EE
9A
19
INC
$199A
19B9-
88
DEY
19BA-
FO
03
BEQ
$19BF
19BC-
4C
40
19
JMP
$1940
19BF-
4C
00
19
JMP
$1900
Rotate 128 bytes left 1 bit.
19C2-
8A
TXA
19C3-
48
PHA
19C4-
98
TYA
19C5-
48
PHA
19C6-
A2
7F
LDX
»$7F
i9ca-
2C
04
18
BIT
$1,804
19CB-
08
PUF
19CC-
3E
04
18
ROL
$1804, X
19CF-
CA
DEX
19D0-
DO
FA
BNE
$19CC
19D2-
3E
04
18
ROL
$1804, X
19D5-
28
PLP
19D6-
10
08
BPL
$19E0
19D8-
AD
83
18
LDA
$1883
19DB-
09
01
ORA
#$01
19DD-
4C
E5
19
JMP
$19E5
19E0-
AD
83
18
LDA
$1883
19E3-
29
FE
AND
#$FE
19E5-
8D
83
18
STA
$1883
19E8-
68
PLA
19E9-
A8
TAY
19EA-
68
PLA
19EB-
AA
TAX
19EC-
60
RTS
End
of code
. Machine
language
clear screen routine.
19ED-
AO
FF
LDY
#$FF
19EF-
A9
20
LDA
♦ $20
19F1-
99
00
DO
STA
SD0O0,Y
19F4-
99
00
Dl
STA
$D100,Y
19F7-
99
00
D2
STA
$D200,Y
19FA-
99
00
D3
STA
$D300,Y
19FD-
88
DEY
19FE-
DO
Fl
BNE
$19F1
lAOO-
60
RTS
There are 6 BASIC language
subroutines and 4 machine code
subroutines. The BASIC routines are:
OSI BONUS
1. Housekeeping, display
instructions
2. Call machine screen clear
3. Test keys for setup cells
4. Perform cell setup screen
commands
5. Read and Write machine code
from tape into memory
6. Count cycles and pause between
generations.
The machine routines are:
1 . Copy screen to bit list
2. Test and set cells, move result to
screen
3. Rotate 128 bytes left one bit
4. Clear screen.
Of special interest is the machine
code read and store routine located in
BASIC lines 3000-3110. The 6
statements in 3000-3050 store machine
code tape onto the end of a BASIC pro-
gram when you type RUN3a00. The 6
statements from 3070-31 10 will read the
machine code back into memory after
the BASIC program is loaded. You can
save any machine language code, using
these 12 statements, by changing the
low and high memory addresses in lines
3010 and 3070. JVICftO'
Now PUbllCAtiOnS (continued fiom me 3O)
Quiz-The FOR Statement. Piogiam Control
With Decision Making— The IF-THEN
Decision Maker; AND, OR, and NOTj IF-
THEN-ELSE; Metric Conversion Program;
Quiz-IF-THEN and IF-THEN-ELSE. Further
Control— The WHILE Statement; REPEAT-
UNTIL; Revising the Metric Program;
GOTO Where; CASE: An Easier Way To
Make Multiple Choices; CASE and
BOOLEANs; The Metric Conversion Pro-
gram Once Again; Quiz. Procedures (The
Second Time Around) and Functions—
Procedures Once Again; Quiz-Parameters;
Functions-the Cousin of Procedures;
FORWARD-Naming a Procedure or Func-
tion Before Its Time; Quiz-Functions.
STRINGS and LONG INTEGERS— M.3X-
imum STRING Length; STRING Intrinsics;
Inputting Numbers With STRINGS; Quiz-
STRINGs; Using LONG INTEGERS for In-
creased Accuracy; Exercises; Quiz-LONG
INTEGERS. More Data Types— Arrays-
Linking Scalars Together; Quiz-Arrays;
Customized Types- "Enumerated User-
Defined Types; Quiz-Enumerated User-
I^Defined Types; Subrange Data Types; Quiz-
MSubrange Types; Sets; Quiz-Sets; Putting It
"a11 Together-The Tic-Tac-Toe Program.
Appendices A: Pascal's Advantages— A
Summary. B. Pascal's Bummers. C. Other
No. 38 -July 1981
Ports of a Pascal System— Assembler;
Library Linker; Dynamic Debugger. D.
ASCII Character Codes. E. Assembly
Language Interfacing— Vfhy Use Assembly
Language With Pascal?; How Pascal
Handles Assembly Language; External Pro-
MICRO - The 6502/6809 Journal
cedures and Functions; The Five Steps; A
Practical Assembly Language Example:
PEEKPOKE; The Pascal Library; Quiz. F.
The 6502 Microprocessor. G. Inaccuracies
of the Amortization Loan Formula. H.
Answers to Quizzes. Index.
The Pascal Handbook by Jacques
Tiberghien. Sybex, Inc. (2344 Sixth
Street, Berkeley, California 94710),
1981, X, 476 pages, diagrams, 7x9
inches, paperbound.
ISBN: 0-89588-053-9 $14.95
A comprehensive, alphabetical dic-
tionary of every Pascal symbol, reserved
word, identifier, and operator for most
existing versions of Pascal, including
Jensen & Wirth (standard and CDC
versions), H-PIOOO, OMSI(DEC),
Pascal/Z, ISO, and UCSD Pascal. Each
of the 180 entries contains the defini-
tion, syntax diagram, semantic descrip-
tion, implementation details, and
program examples.
77
OSI BONUS
LOGICAL SOFTWARE, INC.
announces:
DATA EASE
A NEW, EASY TO USE DATA BASE MANAGER
FOR OHIO SCIENTIFIC 65 U SYSTEMS
— Standard Data Base Features
PLUS
— HIerarchai Structure
— Modify or Restructure thie Data Base At Any
Time
— Up to 8 Files in Memory At Once
— Can be Used from Basic Programs
— Complete Documentation and Tutorial
Introductory Price $99.95
$2.00 Postage & Handling
Finally logical software for
Logical Software, Inc.
P.O. Box 354
Farmington, Ml 48024
(313) 474-8774
OSI
Dealer's Inquiries Invited
SOF='-rUJAFiE l='OR OI-4ZO SCIEtMTIF=-IC
VIDEO EDITOR
Vidao Editor is a poMvrful full scrvan •ditor for disk-bas*d
OSI systsMS with tha pollad kayboard (axcapt CIP) . AIIdms
full cursor — control with insartion, dalation and duplication
of source -for BASIC or OSI's Asscmblar/Edi tor. Unlika
var si ons wri ttan in BASIC, this nachina-coda ad i tor is
co-rasident Hith BASIC (or the Assembler), autoloading into
the highest three pages of RAM upon boot. Video Editor also
provides single-keystroke control of sound, screen for eat,
color and background color. Eight-inch car Mini disk:
«14.93. Specify amount of RAM.
SOFT FRONT PANEL
Soft Front Panel is a software single-stepper, slow-stepper
and dabuggai — emulator that permits easy development of 6502
Machine code. SFP is a -fantastic monitor, simultaneously
displaying all registers, -flags, the stack and more.
Address traps, opcode traps, traps on memory content and on
port and stack acti vi ty are al 1 supported . Thi s is for di sk
systens with palled keyboard and color (b&M monitor ok) .
Uses sound and color capabilities of OSI C2/C4/C8 systems
(not for CIP). Eight-inch or mini disk «24.95. Specify
amount of RAM. Manual csnly, «4.9S (May be later credited
toward software purchase). Six page brochure available free
upon request.
TERMINAL CONTROL PROGRAM
OSI-TCP is a sophisticated Terminal Control Program for
editing OS— 65D3 -files, and for uploading and downloading
these f i 1 as to other computers through the CPU board' s
serial port on OSI C2, C4 and C8 disk-based systems with
pol 1 ed keyboards. Thi rteen edi tor commands al 1 ow f ul 1
editing of files, including commands for sending any text
out the terminal port and saving whatever text comes back.
INDLITL utility included for converting between BASIC source
and TCP file text. Eight-inch or mini disk *39.9S. Manual
only, «2.9S.
OSI-FORTH 2.0 / FIG-FORTH 1.1
OSI-FORTH 2.0 is a full implementation of the FORTH Interest
Group FORTH, for disk-based OSI systems (C1,C2,C3,C4,CS) .
Running under 0S6SD3, it includes a resident text editor and
6S02 assembler. Over one hundred pages of documentation and
a handy reference card are provided. Requires 24K <20K CIP).
Eight-inch or mini disk S79.95. Manual only, «9.9S.
'OSI-FORTH Letters" software support newsletter *4.0O/year.
All prices postpaid. Florida residents add 4X tax.
inquiries are invited. Allow 30 days for delivery.
Dealer
WRITE FOR FREE CATALOG
OF SOFTWARE AND HARDWARE
FOR OHIO SCIENTIFIC !•
Technical Products Company
P.O. Box 12983 Univ. Station
Gainesville, Florida 32&04
SOFTUIAAC fOA.OSI
K^ Three games. Meteor Mission is an asteroids game. Space Wars is a battle between
two starships. Meteor Wars is a combination of the two above games. All three are
VIDEO GAMES 3 . . .M?. $14.95
y*- in machine language with fast, real time action, and super graphics.
-^ ADVENTURE: IMMORTALITY $11.95
You are an intrepid explorer searching for the fabled "Dust of Immortality". This is
-^^ the largest adventure yet for 8K OSI! With hidden room load so you can't cheat.
JX SUPER BUG! $6.95
^ Here's a super-fast, BASIC/Machine language hybird race game. Ten levels of
J-f difficulty and a infinately changing track will l<eep you challenged.
>, DUNGEON CHASE $9.95
■>* A real-time video game where you explore a twenty level dungeon.
STARGATE MERCHANT ..?*.. $9.95
You are a trader in the distant future, traveling through 'stargates' to get to various
star systems. Part video game, part board game, always challenging.
ADVENTURE: MAROONED IN SPACE $11.95
An adventure that runs in SKI Save your ship and yourself from destruction.
DISASSEMBLER $11.95
Use this to look at the ROMs in your machine to see what makes BASIC tick.
Reconstruct the assembler source code of machine language programs to
understand how they work. Our disassembler outputs unique suffixes which
identify the addressing mode being used, no other program has this!
SUPER! BIORHYTHMS $14.95
A sophisticated biorhythm program with many unique features.
{
SUPER
EXPANSION
BOARD
GAMING DISPLAYS
HI-RES PLOTTING
CUSTOM CHARACTERS
3-D VIEWS
^^^^ ■ -
■■'''M
fei-
jpr^l
^
M
SEB-1 Assembled, Tested, W/5k RAM— $249.00 Kit $139.00 Bare Board $59.00, SEB 2/3/4
The SEB-1 is a high resolution color graphics/memory expansion board for the
Ohio Scientific Challenger 1P/Superboard II personal computers. The board is
designed to connect to the computer with no modification and provides the
user with the following capabilities:
• Eleven software selectable display modes-from a 32X16 alphanumeric to a
256X192 point addressable display. • 16K user expansion RAM.
Coming soon, a ROM chip to support the SEB!
Powerful screen editing, plus Apple-like
graphics commands allow you to run
modified Apple software. Write for prices.
Write for FREE catalog
(For International requests, please supply 2 oz. postage)
n D I n M SOFTWARE ASSO.
\J ri I \J 1^ 147 Main St. Ossining, NY 1(
10562
• User configurable RF or composite video output. PrJCeS Ofl reOUeSt
• Up to eight colors • 6K display RAM.
• An eight bit parallel port w/handshake. • Two sixteen bit timers/counters.
The following expansion boards for the C2/C4/C8 series computers are available
SEB-2 Color graphics/floppy controller. Same graphics capabilities as theSEB-land
a software/hardware compatible floppy controller. SEB-3 80X24 video display
generator/floppy controller. SEB-4 48K RAM expansion board.
Coming soon
ADVENTURE: VOLCANO OF KANTHOR .... $29.95
Simply the largest adventure anywhere for OSI! Requires 32K and one disk drive.
Over 150 rooms! Magic, monsters, and the evil Klopslwel await you. Sure to keep
you amused for a LONG time.
VIDEO GAMES 4 $14.95
Invaders fromOrion (R). Three fantastic, fast, real time invaders games, in machine
language, of course. A simple invaders game, an invaders for two, and the most
fantastic invasion game yet awaits you.
78
MICRO - The 6502/6809 Journal
No. 38 -July 1981
-jrp: j.j.,', '""i-nT'S^'V?*! ''^'i'J'SS 'iZHSf'^V'^'-
OSI BONUS
Step and Trace for CI P
This article presents a single
step trace for BASIC programs.
>
M. Piot
36 r R.Poulin
14200 Herouville, France
Type RUN, press RETURN: nothine
occurs! Is it the BIGBUG?
. No! Press S and the first instruction
IS executed, press S again and the next
instruction is executed, press T and the
number of the line embedding the last
executed instruction is displayed. Press
u and the third instruction is executed
Sess CtoTp'' 1 '^' ^^^ is displayed,
wess CTRL C and you can ask the com-
puter for the value of a variable. Are you
dreammg? No, you just use the 40 byte
program in listing 1.
Since I believe a true computerist
must never run a program before he has
tned to understand how it works, here
are some explanations for those of you
not experienced enough with the
routines in ROM (interpreter and
monitor).
Though the monitor and the inter-
preter are in ROM, they sometimes
jump bnefly in RAM (at 0001, 0003
0071, OOAl, 00A2, OOBC, 00C2, 0207,'
020A for the interpreter and 0000, OOFE
0218, 021A, 021C, 021E, 0220 for the
momtorj. The five last addresses (named
VECTORS) are particularly interesting.
Let me show you how they work with
an example — the one concerning 021A.
Every time BASIC wants to output a
character to the screen, it executes the
following instruction:
20 EE FF
(You can see one at
A8F4-A8F5-A8F6)
This means jump to the routine begin-
ning at FFEE [not EEFF), execute it and
then come back.
k Let's look at FFEE (in the monitor):
r there you find
6C 1A02
which means jump to the routine whose
address is stored in 021A-021B.
At 021A [in RAM) you find 69FF
me BREAK key is pressed. What is FF69
(not 69FFJ? It is the begim4 of the
6U at FF8A. This 60 means go back to
tne mstruction following 20 EE FF.
WEiLAND (the next tune you "cold
start your machme, answer A to the
question "MEMORY SIZE?"i| didn't
write 20 69 FF at A8F4. It is to allow you
to eventually change the normal process
by changing the address in 02IA-021B
For example, change 69FF to 6CFF and
you 11 suppress the video output. 0207 is
used every time BASIC asks for a
character (from the keyboard or the
c^sette) through 20 EB FF. 021E is used
whenever BASIC asks for SAVE through
20 F4 FF, and 0220 is used when BASIC
asks for LOAD through 20 F7 FF.
Every time an instruction has been
executed, BASIC jumps to the address
stored at 021C-021D through 20 Fl FF.
This address is normally FF9B the
beginning of the CTRL C routine.' This
IS the heart of the program.
I have changed FF9B for 0222 where I
have stored a program which is executed
after every instruction of the BASIC pro-
gram. Four commands are recognized:
S executes the next instruction
T displays the number of the line
U executes one instruction and displays
the number of the line
CTRL C works as usual and allows you
to ask the computer for the value of a
variable [or more) by typing
PRINT X or PRINT X;Y
(for example)
in the immediate mode.
character from the keyboard and stores
It m the accumulator (A) of the 6502
nucroprocessor; one beginning at B95A
which displays the number of the line.
How to Store the Program in RAM
To store your program in RAM you
m7oi'^?^ M" your system, type
U112/. Then enter the 40 bytes (one
byte CR one byte CR etc..) and then
"BREAK W" the system to run your
program. You may also store those 40
bytes by "POKEmg" them with the
following program you run, using RUN
63992:
63991
63992
63993
63994
63995
63996
63997
63998
63999
END
FOR I = 546 TO 585
READW
POKE I,W
NEXT
DATA 32,0,253,162,105,142,
26,2,201,3,240,25,201,83
DATA 240,21,201,85,240, 14
DATA 201,84,208,232,32,90,
185,162,108,142,26,2,240
DATA 3,32,90,185,76,155,255
How to Get Into the S T U Mode
As the first line of your program (or
of the portion you want to study) you
must use
POKE 667,96: POKE 541 2'
POKE 540,34
POKE 541,2 and POKE 540,34 [numbers
m decunal J store 0222 instead of FF9B in
021C-021D. I will let you find the why
of POKE 667,96! [Hint: the 96 is an
RXS.
Problems with INPUT?
After a CTRL C, you may re-enter
my program by pressing S, typing
CONT, and pressing RETURN. This
jumps to two routines in ROM: one
beginning at FDOO which gets a
When a program that is run in the T
mode reaches an INPUT statement, the
displaying of line numbers stops but
no ?" appears on the screen. Press
RETURN U, answer the INPUT request
as usual and go on tracing.
This program is not only a debugging
aid, it is also very helpful to understand
the way the interpreter runs programs.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
79
jl^H OSI BONUS
GETCHR
EQUr$FDOO
DISPLN
EQU $B95A
CNTRLC
EQU $FF9B
BRKVEC
EQU $021A
0222 2000FD
START
JSR GETCHR
CHARACTER IN A
0225 A269
LDX #$69
0227 8E1A02
STX BRKVEC
TO SUPPRESS VIDEO
OUTPUT
022A C903
CMP #$03
IS THIS A CTRL C?
022C F019
BEQ RTN
022E C953
CMP'S
0230 F015
BEQ RTN
0232 C955
CMP'U
0234 FOOE
BEQ LNDISP
0236 C954
CMP'T
0238 DOES
BNE START
023A 205AB9
JSR DISPLN
DISPLAYS LINE NO.
023DA26C
LDX n6c
023F 8E1A02
STX BRKVEC
TO RESTORE VIDEO
OUTPUT
0242 F003
BEQ RTN
(ALWAYS!)
0244 205AB9
LNDISP
JSR DISPLN
DISPLAY LINE NO.
0247 4C9BFF
RTN
JMP CNTRLC
END
NORMAL CTRL C
ROUIINE
iMCAO
c
75.00
20.00
$ 45.00
45.00
65.00
14.95
99.95
$
$
$109.95
$ 74.95
$29.95
$ 39.95
Z-FORTH IN ROM by Tom Zimmer
5 to 10 times faster than Basic. Once you use it, you'll never go back to BASIC!
source listing add
OSI FIG-FORTH True fig FORTH model for 0S65D witti fig editor named files, string
package & much more
TINY PASCAL Operates in fig-FORTH, an exceptional value when purchased vxith forth.
TINY PASCAL & documentation
FORTH & TINY PASCAL
SPACE INVADERS 100% machine code for all systems with 64 chr. video. Full color & sound
on C2, 4P & 8P systems. The fastest arcade program available.
PROGRAMMABLE CHARACTER GENERATOR ^, ^ „
Use OSI's graphics or make a complete set of your own! Easy to use, comes assemtjied & tested.
2 Mhz. boards
PROGRAMMABLE SOUND BOARD
Complete sound system featuring the AY-3-8910 sound chip. Bare boards available.
32«4 CHARACTER VIDEO MODIFICATION „ „ ,^ ^. .
Oldest and most popular video mod. True 32 chr. C1P, or 32(64 chr. C4P video display.
Also adds many other options.
ROMS!!!
Augment Video fy^od with our Roms. Full screen editing, print at selectable scroll, disk support and many more
features. Basic 4 & Monitor * ^|H
AN 3^' « 65-00
65D DISASSEMBLY MANUAL, by Software Consultants. First Class throughout.
A must for any 65D user. * ''^•^^
NUMEROUS BASIC PROGRAMS, UTILITY PROGRAMS AND GAMES ALONG WITH HARDWARE PROJECTS. ALL
PRICES ARE US FUNDS. Send for our $1.50 catalogue with free program (t^ardcopy) Memory Map ar\d Auto Load
Routine.
OSI Software & Hardware
3336 Avondale Court
Windsor, Ontario, Canada N9E 1X6
(519) 969-2500
3281 Countfyside Circle
Pontiac Township, Michigan 48057
(313) 373-04158
imssm
£
80
MICRO - The 6502/6809 Journal
No. 38 -July 1981
An Introduction
to Bit Pads
By Loren W. Wright
The following articles describe two
microcomputer implementations of a
bit pad. In the first, Peter Coyle
describes how to use the 8-bit parallel
interface version [cheaper than the
IEEE-488 interface version) with a PET.
The hardware aspect of the article is ap-
plicable to any microcomputer with a
parallel port, and the software is conver-
tible, with few chjinges, to almost any
6502 machine. The second article, by
Ralph Erickson, describes a program to
process data through an RS-232 interface
(AIM 65) and save the data to tape or
DAIM disk.
A bit pad can be a valuable addition
to your microcomputer system, but
many people are vuiaware of what a bit
pad is, and what it can do. The following
article (and photo) was compiled from
information supplied by Summa-
graphics Corporation, the manufacturer
of Bit Pad One and other bit pad and
digitizing products.
Essentially, a bit pad is a rectangular
tablet that senses the position of an elec-
tronic stylus or a crosshair "cursor"
above its surface. This information is
converted to digital information and
sent to the computer. The stylus, with
interchangeable non-marking and mark-
ing tips, is included with Bit Pad One,
but one-, four-, ;and thirteen-button
crosshair cursors are also available.
Operating Modes
Bit Pad One modes and sampling
rate may be controlled externally under
program control, or internally by
switches on the logic board. The power-
up mode and sampling rate are deter-
mined by the positions of the internal
switch. Both the mode and sampling
rate may be changed under program con-
trol from the host computer by sending
the Bit Pad One either one ASCII
character or eight-bit byte, depending on
the resident interface. The following
modes are available:
Point Mode— Depression of the
stylus on the tablet, or pressing a button
on the cursor causes one jr-, y-coordinate
pair (sample) to be output in the
appropriate format.
Stream Mode — x-, y-coordinate pairs
(samples) are generated continuously at
the selected sampling rate when the
stylus or cursor is in the proximity of
the active area of the tablet. Pressing the
stylus to the tablet, or depressing a but-
ton on the cursor marks the flag
character (F) bit in the output string.
This mode is typically used for CRT cur-
sor control (cursor steering).
Switch Stream Mode— Depression of
the stylus, or pressing a button on the
cursor causes x-, y-coordinate pairs
(samples) to be output continuously at
the selected sampling rate untU the
stylus or button is lifted.
Bit Pad One comes in two sizes —
11" X 11" and 15" x 15", and with
three interfaces — RS-232, 8-bit parallel,
and IEEE-488. Prices (at press time)
range from $730 for the 8-bit parallel
version in the 11" x 11" size to $1395
for the IEEE-488 version in the 15" x
15" size. Also, I understand that Bit Pad
One is now available with a 16-bit
parallel interface, although first-hand
details are not available at present. A
power supply is also required — $95 for
the U.S. model.
Applications
Applications of a bit pad are only
limited by the user's imagination. Data
entry can be done by checking the ap-
propriate box on a pre-printed form laid
on the tablet. To select items from the
computer screen, the CRT cursor can be
directed with the movement of the bit
pad stylus. Patterns can be drawn on the
screen using the bit pad as an electronic
brush and canvas. In drafting, often-
repeated symbols like doors and win-
dows or NAND gates and transistors can
be selected, and then positioned proper-
ly, using the stylus. In education, the
process of typing in an answer can be
eliminated, thus allowing the student to
focus on the subject. Of course, game
applications are probably the first things
to come to mind. JUOIO"
No. 38 -July 1981
MICRO - The 6502/6809 Journal
81
The ultimate /mPPL£ copy prcigrain
COPY II PLUS
$39"
VERSATILE — Copy H Plus copies multiple
formats — DOS 3.2, 3.3, PASCAL,
FORTRAN, and CPM.
FAST — Copy n Plus copies diskettes in less
than 45 seconds. That's faster than most
other copy programs. Written entirely in
ultra fast assembly language.
CmmAi mum
Software, Inc.
or check
Search no more for that truly versatile, fast
copy program. Copy n Plus is the most
advanced copy program available for the
Apple n Computer. Compare capability,
compare speed, compare price, then call or
write to order Copy n Plus. Requires Apple n
with 48K and at least one Disk Drive.
P.O. Box 3563
Central Point, OR 97502
(503) 773-1970
Deliveries from stock. No C.O.D.'s
Apple is a registered trademark of Apple Computer, Inc.
32 K BYTE MEMORY
RELIABLE AND COST EFFEQIVE RAM FOR
6502 (j 6800 BASED MICROCOMPUTERS
AIM 65-*KIM*SYM
PET*S44-BUS
♦ PLUG COMPATIBLE WITH THE AIM«/SYM EXPANSION
CONNECTOR •BY USING A RIGHT ANGLE CONNECTOR
(SUPPLIED) MOUNTED ON THE BACK OF THE MEMORY
BOARD
• MEMORY BOARD EDGE CONNECTOR PLUGS INTO THE
6800 S 44 BUS.
• CONNECTS TO PET OR KIM USING AN ADAPTOR CABLE.
« RELIABLE-DYNAMIC RAM WITH ON BOARD INVISIBLE
REFRESH-LOOKS LIKE STATIC MEMORY BUT AT
LOWER COST AND A FRACTION OF THE POWER I IS
REOUIRED FDR STATIC BOARDS. b^i
* USES ♦SV ONLY. SUPPLIED FROM HOST COMPUTER
♦ FULL DOCUMENTATION. ASSEMBLED AND TESTED
BOARDS ARE GUARANTEED FOR ONE YEAR AND
PURCHASE PRICE IS FULLY REFUNDABLE IF BOARD IS
RETURNED UNDAMAGED WITHIN 14 DAYS.
ASSEMBLED WITH 32K RAM $349.00
i WITH 16K RAM $329.00
TESTED WITHOUT RAM CHIPS $309 00
HARD TO GET PARTS (NO RAM CHIPS)
WITH BOARD AND MANUAL $ 99.00
BARE BOARD & MANUAL $ 49.00
U.S. PRICES ONLY
16K MEMORY
EXPANSION KIT
ONLY
$29
FOR APPLE, TRS-80 KEYBOARD,
EXBY, AND ALL OTHER 16K
DYNAMIC SYSTEMS USING
MK4116-3 OR EQUIVALENT
DEVICES.
* 200 NSEC ACCESS, 375 NSEC
CYCLE
* BURNED-IN AND FULLY
TESTED
* 1 YR. PARTS REPLACEMENT
GUARANTEE
* QTY. DISCOUNTS AVAILABLE
AU ASSaiBLEO lOARDS AND
MEMORY CNTS CARRY A FULL ONE
YEAR REPUCatBIT WARRANTY
IQ30 uu.coums Ryg.
ORflnCe, Cfl '?'2668
(714)635 7580
82
MICRO - The 6502/6809 Journal
No. 38 -July 1981
PET Interface to Bit Pad
A PET machine language
sampling routine to read x-,
y-coordinate data through the
8-bit parallel Interface of the
Summagraphlcs Bit Pad.
Additional Information has been
supplied for hardware and
software implementation on a
SYM or AIM. A PET BASIC
program Is provided to drive the
routine and write data to tape.
Another reads data from tape.
Peter Coyle
Dept. of Anatomy
University of Michigan
Ann Arbor, Michigan 48109
Editor's Note: The Svanmagmpbics
Bit Pad descnbed heie is a discontinued
model. Bit Pad One is the cunent
compaiable modd. The main difference
is that Bit Pad bad a separate console,
vfheieas Bit Pad One has all the elec-
tronics contained in the tablet unit. The
baidwaie interface and program require-
ments are the same for the two models.
Mr. Coyle' s original machine
language sampling routine for the PET
has been modified shghtly by the
MICRO staff to make implementation
on other systems easier. Hardware con-
nection information is summarized in
table 1, and programming information is
provided in table 2.
Data or instruction entry into a
microcomputer via the keyboard is
relatively slow. Quicker entry can be
accomplished by placing a stylus over a
coded string of information on a chart. A
sensor detects the spatial position of the
stylus, digitizes, aad then transfers the
X- and y-coordinate values to a computer
for decoding. Coordinate values can
code variables such as points in space,
computer instructions, names, titles,
parts, recipes, grades, costs records, and
many others. A nearly-endless list may
be generated.
Pet User Port J2
Bit Pad D-Connector
Contact
Function
Pin#
B
CAl
Byte Available
20
C
PAO
DO
8
D
PAl
DI
10
E
PA2
D2
12
F
PA3
D3
14
H
PA4
D4
16
J
PAS)
D5
18
L
PA7)
Byte Received
19
M
CB2
Next Byte
21
N
23GNE
Figure 1: Hardware Interface
Table 1: Parallel Port Connections
J2
AA
Signal
PET/CBM
SYM
AIM 65 1
Name
Parallel User Port
VIA #2
Jl
CAl
B
E
20
PAO
C
D
14
PAl
D
3
4
PA2
E
C
3
PA3
F
12
2
PA4
H
N
5
PAS
J
11
6
PA6
K
M
7
PAZ
L
10
8
CB2
M
S
19
GND
N
1
1
Information compiled by MICRO staff.
Table 2: Parallel Port Addressing
Address
Program
Description
Symbol
PET
SYM
AIM
Output register A
ORAHS
$E841
$A801
$A001
with handshaking
(S94S7)
(43009)
(40961)
Data direction
DDRA
$E843
$A803
$A003
register,
Port A
159459)
(43011)
(40963)
Peripheral contro
i PCR
$E84C
$A80C
$A00C
register
(59468)
(43020)
(40972)
Interrupt flag
IFR
$E84D
$A80D
$AOOD
register
(59469)
(43021)
(40973)
Output register A
ORANHS
$E84F
$A80F
$AOOF
without handshaking
(59471)
(43023)
(4097S)
Information compiled by MICRO staff.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
83
11
A two-dimensional coordinate
system offers flexibility for many prob-
lems and the mapping of two variables,
each on a different spatial axis. The
Summagraphics Bit Pad, a digitizer for
entering two-coordinate information in-
to a computer, was interfaced to the 16K
Commodore PET parallel user port.
This article gives the hardware interface
and presents software developed for suc-
cessful interdevice commimications.
Hardware
The Bit Pad consists of several
system elements. There is an 11 -inch
square pad with magnetostrictive wires
on a substrate beneath the surface. A
strain wave is propagated along all wires
simultaneously. On the pad surface, a
moveable stylus or cursor senses the
passing strain wave. Delay between in-
itiation and sense time is used to code x-
and y- coordinate positions of the stylus.
The active area of the pad has about 8
million resolvable points with a spatial
resolution of about 0.1 millimeter. A
console cabinet houses the controller
card, serial TTL line and 8-bit parallel
port with handshake line cormectors.
Power supply is self-contained and an
additional purchase. Data collection
modes and digitizing rates can be
specified via console cabinet switches or
implemented through host processor
control. The developed software does
not utilize host processor control of col-
lection modes nor digitizing rates.
Figure 1 indicates the wired connec-
tions and handshake signal names. No
additional hardware logic elements were
required for the interface. The Bit Pad
has three handshake lines but there are
only two on the PET prarallel user port.
The problem is easily solved for only
bits 0-5 of the byte convey coordinate
data. Bit 7 of the parallel user port could
therefore be used as the third handshake
hne (BYTE RECEIVED). The sampUng
routine keeps track of the bjrte nimiber.
One Cinch 251-12-30-160 board edge
connector for the PET, three feet of 12
conductor ribbon cable, and the includ-
ed Bit Pad data bus connector were
utilized in making the hardware link.
Data and Handshake Lines
For each digitized point, five 8-bit
bytes (words) of data are put on Bit Pad
even-numbered lines 8-22 inclusively.
Bits of the first transmitted word in-
dicate the status of flag buttons on the
optional cursor. These bits can be used
to control program or computer
activities, but the developed software
discards the first byte. The second word
bits 0-5 are less significant for the x-
coordinate, while byte three bits 0-5 are
Listing 1
500
S10
515
520
530
540
545
550
555
560
570
588
590
600
610
620
630
640
650
660
670
680
690
700
710
720
730
740
750
760
770
780
790
800
810
820
830
840
850
860
870
888
898
988
918
920
938
948
958
960
978
988
998
REM***PROG DIGITIZE
REM**#BV PETER COVLE
REt1***WRITTEN FOR 16K OR LARGER
REM***L0RD BIT PAD SfiMPLING ROUTINE
REM*«*L0FID BLRNK TRPE TO STORE X RND V VRLUES
REM***DRTR STORE 12888 DEC,328eHEX
REM
POKE 52,255: POKE 53,23: CLR : PROTECT MEMORV FROM BRSIC
REM OLD ROMS — POKE 134,255: POKE 135,23
POKE 893,58: POKE 897,80: REM INITIALIZE DRTR STORE BASE
TE=0: REM SET TRPE WRITE FLAG TO ZERO
PR I NT "3" : REM CLEAR SCREEN
PRINT" INPUT tt SAMPLES": INPUT N: N=N*4 • REM 4 BVTES/POINT
A?i=INT<N^256;i : REM COMPUTE HI ORDER BVTE OF N
Bfi-INT<:N-<256*AX>>: REM COMPUTE LO BVTE OF N
poke" 828, BX: REM STORE LO N IN SAMPLING ROUTINE LOC *033C
POKE 829, AX: REM STORE HI N IN SAMPLING ROUTINE LOC *833D
PR I NT "START SAMPLING DATA"
SVSCSae^ : rem transfer control to sampling ROUTINE
A=PEEK<:893> : REM FETCH BASE VALUE
B=PEEK<826> : REM FETCH COUNTER
N=<'CA-50>*256+B>; REM COMPUTE « PTS
GOSUB860: REM FETCH DATA POINTS
PRINT" IF DATA TO BE STORED ON TRPE, TVPE : "
PR I NT "GOTO 730" : REM PRINT ON SCREEN
STOP: REM WRIT FOR INSTRUCTION
GOSUB 750
END
REMitiiliiliSUBROUTINE DUMP TO TAPE
TE-1 : REM SET FLAG EQUAL TO ONE
PR I NT "3" : REM CLEAR SCREEN
PRINT"ENTER EXPERIMENT NUMBER": INPUT E«
PR I NT "ENTER R / L HEMISPHERE" : INPUT H»
PR I NT "ENTER NUMBER OF X ,' V POINTS" : INPUT N*
0PEN1,1,1,E*+H*: REM OPEN AND NAME FILE
PRINT#1 ,STR«CN) f"," ;E*; " , "H»
GOSUB 860: REM FETCH X AND V AND WRITE TO TRPE RND SCREEN
CLOSE 1
RETURN
REM«**SUBROUTINE TO RETURN X AND V
PRINT" I"," X"," V"i REM PRINT SCREEN COLUMN HERDERS
PRINT
FOR 1-8 TO N-4 STEP 4
A»PEEK< 12800+1 >:B»PEEK< 12800+1+1): REM GET X LO RND HI BVTES
X=<B«64)+A: REM SHIFT X HI BITS « COMBINE WITH LO ONES
R=PEEK<12800+I+2>i B=PEEK';i2880+I+3> : REM GET V LO AND HI BVTES
V=<Bi|i64>+fl: REM SHIFT V HI BITS & COMBINE WITH LO ONES
IF TE=8 THEN 968: REM BVPASS WRITING TO TAPE IF FLAG 8
PRINT#l,X;",",Vi REM WRITE TO TAPE
PRINTI,'4+l,X,Vi REM PRINT ON SCREEN
PRINT" ' ": REM UNDERLINE
NEXT I
RETURN
Listing 2
500
510
520
538
560
570
580
598
608
610
620
638
648
650
668
670
680
eae
700
REM*****PROG DRTR RERDER
REM*****BV PETER COVLE
REM#****RERD IN X RND V FROM TAPE
REM
DIM X<:200>,V<200>:REM DIM RRRRVS
PR I NT "3" :REM CLEAR SCREEN
PR I NT "ENTER EXPERIMENT NUMBER"
PRINT"ENTER R / L HEMISPHERE":
PR I NT "LORDING IN DRTR"
OPEN1,1,0,E*+H*: REM OPEN FILE
INPUT#1,N,E*,H*: REM READ FROM TAPE
N=N/4: REM N
PRINT" I","
FOR I>=1 TO N
INPUT#l,X<n,V<I>: REM READ IN DATA
PRINT I,X<n,V<I>: REM PRINT DATA ON SCREEN
NEXT I
CLOSE 1 : REM CLOSE FILE
END
INPUT E*; REM ENTER FILENAME PART
INPUT H*! REM ENTER FILENAME PART
INTO FILE
NUMBER OF SAMPLE POINTS
X"," V":REM PRINT COLUMN HEADERS
hi
84
MICRO - The 6502/6809 Journal
No. 38 -July 1981
fr^'. W!^^. " ■ r s' ^S\:m
0800
, *****«*«*«««ik«*«*********
0800
.*
*
Listing 3
0800
,•* lOTERFACE ROOTDJE FOR *
0800
;* SlMISGRflPHICS BIT PAD •
0800
.*
*
0800
,*
By PETiiK canz *
0800
•*
*
0800
It************************
0800
*
0800
ajTi
BQU 5033A
0800 pom
BQU $033B
0800 DO
BQU $033C
0800 HI
BQU $033D
0800
0800 CStMTR BQU $E813
; (59411) PET ONLY
08OO
0800
PET ADDHESSES—SEE TABLE FOR AIM &SYM BCJUXVALEHTS I
0800
0800 C
)RAHS
BQU $E841
; (59457)
0800 I
3DRA
ECO $E843
,-(59459)
0800 I
■CB
BQU $E84C
,-(59468)
0800 ]
[FR
EQU $E84D
; (59469)
0800 OBANHS BOU ?E84F
,-(59471) OOTTOT RBGISTER A— NO HANDSBAKIN3
0800 NUMCHR BQU $009E
;NUMBER OF CHARACIERS IN KEYBOARD BUFEER
0800
FOR OID PET, MJMCHR EQO ?0
20D
0800
033E
ORG $033E
033E
CBJ $800
033E
033E A901 mlTKL l£A tfOl
•SET
0340 8D3A03
STA am
-COUNIER TDl
0343 A980
na #$80
-MAKE PA7 OUTPOT
0345 8D43E8
STA EC8A
t PAO-6 INPUr
0348 AOOO
LOT MOO
INITIALIZE POINTER
034A A205 N
lEXTS
UX *$05
BYTE (XUNTER
034C 206503 I-
msD
JSRBANDl
HMlDEEnKE BIT PAD
034F CA
EEC
0350 DOFA
ENE HAND
(SET NBCr BYTE OF SAMPI£
0352 209B03
JSR DIET
TEST FOR LRST BYTE
0355 a)3AQ3 C
CMP
CMP am
TEST IFUtST EAMPI£
0358 F002
BEIQ END
LRST S«MPI£ POIOT
035A DOEE
EME MEXTS
NB<T SAMPU POOn'
035C 60 E
HD
RTS
REIUBN TO BASIC
03SD AD4DE8 »
RIT
LQV IFR
WRIT FOR DnERHUPT
0360 2902
AND #$02
OKCRl LINE B
0362 P0F9
BEQ HAIT
BRRMCHTO WRIT
0364 60
RTS
REIURN
0365 A902 1-
lANDl
UJh. #$02
OOJDITICN
0367 SMteS
STA IFR
nriKKHUPT FLfC RBGISIER
036A A9ED
UA t$W
SET CB2 (NEXT
036C 8D4CE8
Stk PCR
BYTE) HI
036F 205D03
JSR WAIT
WRIT FC« CAl (B.A.) HI
0372 AD41E8
UA ORAHS
DHWr A, CLEAR EIA3
0375 293F
AND #$3F
SHIFT BITS
0377 E005
CPX #$05
lOT BWE TEST
0379 F004
BE)Q SKIP
DCB'T STORE 1ST BYTE
037B 990032 £
TORE
STA $3200,Y
STORE BYTE HERE
037E C8 C
OUT
INY
nCR MEEX POIOTER
037F A9CC E
KIP
UA #$CC
RESET NE<T BYTE LO
0381 8D4CE8
STA PCR
LINE CB2
0384 AD4FE8
U». ORAtBS
0387 0980
ORA #$80
SET PA7
0389 8D4EE8
OTAORMJHS
HI (B.R.)
038C 205D03
JSR WATT
WRIT FOR CRl (B.A. ) LO
038F AD4FE8
IDA ORANHS
0392 297F
AND tSTF
VESEI PA7
0394 8MFE8
STA ORANHS
(B.R.) LO
0397 60
RTS
REOTRN TO HAMX-3
0398 M>3D03 I
iror
ITft HI
039B POOC
NO M3RE HI BYTE
039D COOO
CPY #$00
NB» INDEX CYCLE?
039F DOOF
BHE TEST2
0U3 INDSX CYCLE
03A1 CE3D03
ISX: EL
nECREME»r HI BYTE
03A4 EE/D03
INC STORE+2
liC. EASE BY 256
03A7 E007
aiE TEST2
03A9 OC3C03 1
tsri
CPYIX)
IS lASr BYTE IN?
03ftC D002
ENE TEffr2
NOT THE LAST BYTE
03AE FOOC
BBQ FINI
lAST BYTE IN
03B0 ;
03B0
PDLLOWmG COEB IS PET-SPBa
JIC. SUBSTITOTE A
03B0
GETCHR ROUTINE AND TEST CN
A PABTICUIAR CHARACTER
03BO ;
TOR MftCHQlES CnHER THAN PEl
P
03B0
03B0 AD9E00 1
EST2
UA NUMCHR
TEST KEYBQAK) IN (»$020D, OU) PET!
03B3 D007
EKE FINI
KEYBOARD REQUEST STC»
03B5 A935
LDA *S35
TORN ON BEEPER
03B7 8D13E8
STA CSTMTR
AETER 4'rH BYTE STORE
03BA D004
EKE TALL
NO KEXBCARD INPUT
03BC ;
BSD OF PET-SPEaFIC OCM:
03BC 8C3A03 J
HSI
Sry CKTl
SSMPr.TNt5 OOMPIEIE
03HF 98
Tffi
TRRNSIER Y TO A
03CQ 60 1
filX
Ffrs
RETURN TO OCMP
more significant. The y-coordinate
value is coded in bits 0-5 of words four
and five, with the more significant bits
in word five.
Software
Listing 1 is the program which
defines (BASIC line 550) the top of RAM
available to BASIC but above which the
sampling routine stores coordinate
values. As given, there is space for about
600 points for the 16K machine. On
return (660) from the sampling routine,
the Hi and Lo order data point bytes are
combined (910 and 930) into a floating
point number and displayed. Then the
program requests input (700) if the data
is to be written onto tape. Listing 2 reads
stored data from tape.
For the sampling routine, Summa-
graphics provided a flow diagram of
handshake signals that are required for
any processor. . An initial subroutine
written in BASIC sampled points at
about 1 sample/second. This was much
too slow for our sampling needs. A 6502
Assembly Level Language version was
written that avoids use of zero page loca-
tions which can cause problems with
the new PET. The routine samples at
about 64/second, which is the max-
imum rate of the Bit Pad. The Bit Pad
One is even faster.
Listing 3 is code for the routine
stored in the second cassette buffer.
Data values are stored, starting at hex-
adecimal 3200 (decimal 12800) which
can easily be changed by POKEing 897
and 898 with a new base number.
Because one byte cannot code a number
larger than 255, the 3200 base value is
incremented when the byte counter (Y
register] recycles. Consequently, when
the BASIC program is run, the 3200 base
is initialized each time. Software is
included in the listing to drive the Huh
Electronics beeper and needs no
modification if the beeper is not used.
We find that audio feedback during
point sampling is helpful. Sampling
need not continue until the entered
number, N, of samples are obtained.
Pressing a keyboard key stops the
sampling process and causes return to
the BASIC program. The number of
samples obtained is computed (680)
after PEEKing the values in locations
826 and 890 to determine how many
times the counter recycled (660), and
adding the current cycle count (670).
Once obtained by the above scheme, x-
and y-coordinate data can be used for
distance measurements, counting, posi-
tion coding, or other piuposes.
iMCftO
No. 38- July 1981
MICRO - The 6502/6809 Journal
85
/VyKflOM TECHNICAL PRODUCTS PRESENTS
A DIAGNOSTIC PACKAGE FOR THE APPLE II
AND APPLE II + COMPUTER.
"THE BRAIN SUHGEON"
Apple Computer Co. has provided you with the twst equipment available to date. The'
Diagnostics Package was designed to check every major area of your computer, detect errors,
and report any malfunctions. The Bnin Surgeon will put your system through exhaustive,
thorough procedures, testing artd reporting all findings.
The Tests inclwie:
• MOTHERBOARD ROM TEST
• APPLESOFT ROM CARD TtST
• INTEGER ROM CARD TEST
• MOTHERBOARD RAM TESTS
■ DISK DRIVE SPEED CALIBRATION
• DISK DRIVE MAINTENANCE
• DC HAVES MfCROMOOEM II TEST
(HARDWARE & EPROM)
■ MONITOR k MODULATOR ROUTINES
■ MONITOR SKEWING TESTS
• MONITOR TEST PATTERN
- MONITOR TEXT PAGE TEST
• MONITOR & TV YOKE ALIGNMENT
- LaflES COLOR TESTS
- HIRES COLOR TESTS
• RANDOM HI-RES GENERATOR
■ SPEAKER FUNCTION TESTS
• SQUARE WAVE MODULATION
- PADDLE i SPEAKER TEST
• PADDLE « BUTTON TEST
- PADDLE STABILITY
• rNTERNAL MAINTENANCE
■ GENERAL MAINTENANCE
• ON BOARD -HELP"
(^
The Bnin Surgeon allows you to be confident of your system. This is as critical as the
operating system itself. You must depend on your computer 100% of it's running time. The
BnIn Surgeort will monitor and help maintain absolute peak performance.
Supplisd on dlsk«t1e with compicl*
documantition and mainlvmnca guida
PRICE: (49.95
REQUIRES: 48K. FP in ROM
1 Disk Drtva, DOS ZJt or 3.3
^Nikrom Technical Products
35 PROSPECT STREET • LEOMINSTER. MA 014S3
Ofdar ToH-Fra* AnyhiM
Muter Charga t. VtSA us«rs call: 1-a00435-2246
Kansas Rssrdants c»U: 1-800062-24?]
YOUR COMPUTER
ISA
TYPESETTER
Send tape or disk with text for your
book or other manuscript.
We will process directly on our
typesetter.
VERY LOW COST
for details, contact:
Publisher
Homing's Mills, Ontario
LON IJO Canada
Describe your computer, word-
processor, type of manuscript, etc.
APPLE DISK & MEMORY UTILITY
THE INSPECTOR
These utiKties enable the user to examine data
both in the Apple's memory and on disks. Simple
commands albw scanning through RAM and
ROM memory as well as reading, displaying and
changing data on disk.
Read and rewrite sections of Random Access files.
Reconstruct a blown VTOC. Weed out unwanted
control characters in CATALOG listings.
UnDELETE deleted files or programs. Repair files
that have erroneous data. All without being under
program control, and more
You may transfer sectors between disks. This
allows you to transfer DOS from one disk to
another thereby saving a blown disk when all that's
blown is DOS itself; or to restore a portion of a
blown disk from its backup disk.
Its unique NIBBLE read routine provides a Hi-Res
graphical representation of the data on any track
allowing you to immediately ascertain whether
your disk is 13 sector or 16 sector. Get an 1/0
error...is it because you have the wrong CXDS up?
is it because of a bad address field? or a bad data
field? or because a track was erased? This will
allow you to tell in an instant without blowing away
any program in memory.
• Repairs Blown Disks
• Reads Nibbles
• Maps Disk Space
• Searches Disks
The INSPECTOR even lets you search through
an entire disk or through on-board memory for the
appearance of a string. Now you can easily add
lower case to your programs (with LCA).
Do you want to add so-called illegal line numbers
into your program? or have several of the same line
numbers in a program (like the professional
programmers do)? or input unavailable commands
(like HIMEM to Integer Basic)? or put quotation
marks into PI?INT statements? Here's the easy
way to do them all!
AND MORE
The INSPECTOR provides a USER exit that will
interface your own subroutines with those of the
INSPECTOR itself. For example, just put a
screen dump routine (sample included in
documentation) at HEX 03(X) and press CTRL-Z.
The contents of the screen page will print to your
printer.
ROM RESIDENT ROUTINES
The INSPECTOR utilities come on an easily
installed EPROM. This makes them always
available for instant use. No need to load a disk
and run a program.
FULLY DOCUMENTED
Unlike other software of its kind. The
INSPECTOR comes with an EASY to
understand manual and reference card. Examples
and graphk:s help even the uninitiated use the
power of these utilities. And furthermore, we offer
the kind of personal service whk:h you have never
experienced from a software vendor before.
• Searches Memory
• Edits Disk Sectors
• Outputs Screen to Printer
• Displays Memory In HEX/ ASCII
Sec your LOCAL DEALER OR . . .
Mastercard or Visa users call TOLL FREE 1-
800-835-2246. Kansas residents call 1-800-
362-2421. Or send $49.95. Illinois residents
add $3 sales tax.
SYSTEM REQUIREMENTS
All Apple II configurations that have access to Integer Basic
(either in ROM or RA|v() unll support The INSPECTOR.
Just place the chip in empty socket D8 either on the mother
board or in an Integer firmware card. Apple Il-t- systems
with RAM expansion boards or language systems wi)]
receive the INSPECTOR on disk to merge and load with
INTBASIC.
And.. .if you have an Apple II -*-, without either RAM or
ROM access to Integer Basic, you will still be able to use
The INSPECTOR, because we are making available 16k
RAM expansion boards at a very affordable price. Not only
will you be able to use The INSPECTOR, but you will also
have access to Integer Basic and other languages. These
boards normally retail for $ 195.00. Our price for BOTH the
INSPECTOR and our 16k RAM board is $195.00, a
savings of $49.95 over the price of purchasing both
separately.
Another Quality Product from
Omega Software Products, Inc.
222 S. Riverside Plaza, Chicago, IL 60606
Phone (312) 648-1944
« 1981 Omega Software Products, Inc.
Apple is a registered trademark of Apple Computer, Inc.
BDU3
86
MICRO - The 6502/6809 Journal
No. 38 -July 1981
Bit Pad Routines
for Am 65
An assembly language program
to Interface AIM 65 BASIC to a
digitizer (Bit Pad One) Is
described. The x-, y-coordlnates
of points on a photograph or
chart can be stored In a BASIC
array, simply by placing a stylus,
or the crossniafr of a cursor on
the point, and closing a switch.
Routines are also Included to
save and load BASIC anrays on
cassette tape or disk (DAIM).
These routines are called by the
BASIC USR(W) command, with a
single POKEd entry point, and W
to Indicate the desired routine.
Ralph 0. Erickson
Department of Biology
University of Pennsylvania
Philadeipliia, Pennsylvania 19104
The Rockwell A[M 65 is well designed
foi many applications in the laboratory.
An important class of applications is un-
doubtedly the acquisition of data, either
from instrumenits, such as a spectro-
photometer (Saltero, R., 1980), or from a
di^tizer, as described in this article.
With the prograiQS listed here, you can
log the X- and y-coordinates of a point on
a photograph, drawing, or chart,
mounted on the platen of the digitizer.
This is done by placing the crosshair of a
cursor on the point and pressing a
button, or by depressing a stylus. The
X-, y-values can be stored in BASIC
arrays, ha addition, you can save arrays
as data files on cassette tape, or floppy
disk, and load the saved data fUes into
BASIC anays.
The first routine in the source listing
(2) is written for use with the Svramia-
graphics Bit Pad One. It can be called by
a BASIC program via the USR(O) func-
tion. My Bit Pad is equipped with a
RS-232 interface, and its output (pin 2)
connects to the serial input pin of the
application connector (Jl-Y) of the AIM.
(Other Bit Pad models are available with
8-bit parallel, or IEEE-488 output inter-
face.) The AIM TIT-KB switch must be
left in KB position. Of the several
options described in the Bit Pad User's
Manual, I selected the point mode of
transmission, (rather than stream,
switched stream, or program control
mode), set the baud rate at 1200, and
selected binary data format, (rather than
ASCn data format). In this mode of
operation, the Bit Pad transmits one x-,
-coordinate pair to the AIM as a
sequence of 5 bytes, each time the stylus
is depressed, or a button is pressed on the
cursor. The first byte of the sequence is
identified by bit 6 being set; in the next
4 bytes, bit 6 is clear. In addition, bit 2
of the first byte is set when the stylus is
depressed or the button is pressed.
When the first byte, $44, is detected,
the next 4 bytes are stored. They contain
the binary-coded x-, y-coordinates of a
point to 12-bit accuracy, and 0.005-inch
resolution. Their format is chaikged to
BASIC integer format, and they are
stored indirectly in 4 bytes which can be
accessed by BASIC. To make this possi-
ble, integer variables, Xl%, Yl%, are
defined at the begiiming of the BASIC
program, so that they are defined at the
beginning of the BASIC variable area —
the address of which is at $0075. BASIC
can then re-assign them to other
variables or array(s), where they are ac-
cessible for printing, saving as data
Listing 1
"RUN" DELETES ARRAY
RIM —BIT PAD INPUT & BASIC DATA FILES
REM — ROl POSITICM TAPE; TC1GGLE<1>0FF; & SET "RECORD" TO SAVE DAW
RIM —OR "PLAY" TO LOAD DATA
REM —TO SAVE EXISTING DATA, USE DIRECT "GOTO 60"
S!!
Xl% = 0:Y1% = 0: RIM INITIALIZE INTEGER VARIABLES
POKE 4,0: POKE 5,63: RH1 -S/R AT $3F00
INPUT "NO. OF POINTS" ;N: DIM X%(1,N - 1)
INPUT "DIGITIZE(Y,N)";A$: IF A$ = "N" THQJ 60
PRINT " 0": REM -INPUT DATA FRCM BIT PAD
FOR J = TO N - 1:BP = USR (0):X%(0,J) = X1%:X%(1,J) = Yl%
raiNT J;X1%;Y1%: NEXT
INPUT "TAPE READY (Y,N)";A$: IF A$ = "N" THEN MN
INPUT "SAVE(S)0R LQAD(L)";A$: IF A$ = "L" THEN 110
wo = . USR (1) : RIM -OPEN WRITE FILE
FOR J = TO N - 1: PRINT X%(0,J);",";X%(1,J) : NEXT
100 WC = USR (2) :MN = USR (5) : RIM -CLOSE WRITE FILE
110 RO = USR (3) : REM -OPEN READ FILE
120 FOR = TO N - 1: INPUT X%(0,J) ,X%(1,J) : NEXT
130 RC = USR (4) : RIM -CLOSE READ
140 INPUT "VERIFY LQAD(Y,N)";A$: IF A$ = "N" THEN END
150 FOR J = TO N - 1; PRINT J;X%(0,J) ;X%(1,J) : NEXT
5
6
10
20
30
40
50
60
70
80
90
USR (5)
Instructions for listing 2.
BPSAV— ROUTINES CALLED BY AIM BASIC
-USR(OJ,GTDATA-GETS 5 BYTES FROM BIT
USRl 1 TO:
PAD
-GET X, Y-COORDINATE PAIRS FROM BIT
FORMAT OF 1ST BYTE:
PAD DICmZER
0100 0100 (FLAGS)
-SAVE BASIC ARRAYS AS DATA FILES ON
WHEN THIS IS DETECTED, NEXT 4 BYTES
CASSETTE TAPE, OR DISK
ARE STORED AT DATA,X:
-LOAD BASIC DATA FILES FROM CASSETTE
OOXX XXXX (0-51
TAPE OR DISK INTO
00XXXXXX(6-11J
BASIC ARRAYS
OOYY YYYY (0-5)
BIT PAD IS SET FOR:
00YYYYYY(6-11)
-POINT MODE OUTPUT
THEIR FORMAT IS CHANGED:
-BAUD RATE - 1200(RS-232)
XXXX XXXX (0-7)
-BINARY DATA FORMAT
0000 XXXX (8-11)
YYYY YYYY (0-7|
ARGUMENT OF USR| )IS USED TO FIND
0000 YYYY (8-11)
SUBROUTINES
No. 38 -July 1981
MICRO - The 6502/6809 Journal
87
file(s), or for computation. In the BASIC
demo program (listing 1), I have used~an
integer array to receive the data, because
this requires only 2 bytes for each ele-
ment, which is enough for the 12-bit ac-
curacy of the Bit Pad data.
The routines for saving and loading
data, in listing 2, have some features in
common with programs which have
been published (Bresson, 1980; Flynn,
1979, 1980; Kvaal, 1980). I have tried to
put as much of the coding as possible in-
to assembly language, so as to simplify
BASIC programming. A BASIC program
to save and/or load data, such as listing
1, must POKE the starting address of the
assembled program ($3F00 in this case).
Then the USR(W) function is used to
call the routines for saving and loading,
with the argument of USR[ W) serving as
a pointer into a jump table, where the
address of the desired routine is found.
The monitor subroutines, WHEREO
and WHEREI are called to open files for
saving and loading. These give the stan-
dard AIM prompts for device and file
name, allowing a choice to be made be-
tween tape cassette or floppy disk as the
recording mediimi. Saving on tape is in
response to OUT = T, loading in
response to IN = T. I have the Compas
Microsystems DAIM disk operating
system which uses the user hook, U, so
that, with it, the dialog is OUT = U or
IN = U. Some modification of the pro-
gram might be needed with another disk
system, or perhaps for paper tape.
To save an array which has been
defined by a BASIC program, and
which contains data, BASIC opens a
write file with USR(l), executes a FOR
loop containing the appropriate PRINT
statement(s), then closes the file with
USR(2) . Loading a data file into an array
is done in the same way, with USR(3)
to open a read file, a FOR loop with IN-
PUT statement[s), then USR(4) to close
the file. Note that comma(s) must be
inserted between variable names in the
PRINT statement(s)! In using a cassette
recorder, the tape must be positioned
and the control keys operated manual-
ly; with the disk system, operation is,
of course, much more automatic.
As Kvaal (1980) pointed out, atten-
tion must be given to the management
of file size, to be sure that data files will
fit into the arrays which have been
defined to receive them. These routines
can be used very flexibly. Data, or
values computed from the data, can be
saved by one program, and perhaps
loaded by another program for further
computation, plotting, etc. They are
not limited to saving and loading in-
teger values, as in the demo program.
AND THEY ARE MOVED TO BASIC - ^
LOCATIONS, XI %, Yl% |
ON RETURN TO BASIC, THESE MAY BE
STORED IN ARRAYfS)
-USR|2|,CL0SWR— CLOSES THE FILE,
TURNS OFF THE RECORDER
OR DISK; AND RESTORES PRINTER STATUS
BEFORE SAVING OR LOADING: POSITION
TAPE; TOGGLE RECORDER
-USR(31,OPENRD-OPENS FILE, LIKE
OPENWR
|l|OFF; AND PLACE IT IN RECORD OR PLAY
MODE
OR INSERT DISK
-USRll),OPENWR-SAVES PRINTER STATUS,
PROMPTS FOR DEVICE AND
FILE NAME; STARTS RECORDER OR DISK
BASIC SHOULD THEN(INPUT1DATA FILE
TO DESIRED ARRAY, THEN
-USR|4|,CLOSRD— CLOSES FILE, LIKE
CLOSWR
-USR|5),MONTR-EXIT BASIC
BASIC PROGRAM SHOtn,D
THEN(PRINT|THE DESIRED ARRAY, AND
CALL:
;* *
!* AIM-65 BIT PAD BCOTINE *
1* *
;* BY RALPH 0. EMCKSCK *
,. *
1*
;MC()nOR ADDRESSES
;
GCMIM EQU $E1A1
EUll EQU $ESCIA
VHEBEI BCXI $E848
WHEBBO EQU $E871
Uj EQU $E8ro
KHEK EQU $E907
CRU' EQU $E9F0
Ut'lTlY EQU $GBCB
1
;l/0 ADDRESSES
GAP ECU $A409
PSIFLG EQU $A411
IMEIiG ECU $A412
OJIHiG EQU $A413
BAUD EQU $A417
TBB IQU $A800
7
; BASIC ADEKESSES
•
VRFPTREPZ $75
BASAOC EPZ $A9
IFIX EQU $BEFE
;DAIM AEGRESS
HEADUP EQU $9E10
*
rlNIEtDAL ADDRESS
DATA EPZ $E8 ;4 BYTES FOR DATA
3P00
;
ORG $3F0O
3F00
t»J $800
3P0O
•
3FCI0
•DBOOra: ARGUMENT OF USR( )
3F0O
;
3F00 20EEBE
BPSAV JSR IFK
3F03 ASftC
UK BASA0O3
3F05 D012
EME REriURH
3F07 ASM)
I£R BASA0O4
3F09 C906
CMP #$06
3F0B BOOC
BCS REHJRH
3P0D Cft
ASL
3P0E 85AD
SEA BASAOC+4
3F10M
TAX
3F11 BD1B3F
IXft JTABL+l.X
3F14 48
FHA
3F15 BD1A3F
LDA JTABL.X
3F18 48
FHA
3F19 60
RETORN RTS
3F1A
(Continued)
88
MICRO - The 6502/6809 Journal
No, 38 -July 1981
Listing 2 {Continued)
3F1A
;JUMP TABLE
3F1A
3F1A 263F
JTABL ADR GTTATA-l
3F1C 793F
ADR OPESWR-l
3F1E 8D3F
ADR anfWR-1
3F20 AC3F
ADR OPEMRD-1
3F22 B83F
ADR nnsRD-1
3F24 C83F
ADR M3NTR-1
3F26
J
3F26 00
PSTAT BYT $00 .-PRINIER SIATOS
3F27
.
3F27
';GET lATA FRCW BIT PAD INTO BASIC X1»,Y1%,USR(0)
3F27
;SET BAUD RATE=1200
3F27
;
3F27 A902
GTDATA Ii» #$02
3F29 8D17A4
STA BAUD
3F2C A9FD
UA #$FD
3F2E SDISM
STA BAUDf 1
3F31
;VISII STVUS IS I:B>RESSED, get 1ST BYTE
3F31 20DBEB
JSR GETmr
t
3F34 CS44
CMP noioooioo
3F36 2007E9
JSR KHEK
3F39 DOEC
ENE GTDATA
3F3B A200
UK #$00
3F3D
;GET 4 DhTA BYITS
3F3D 20CBEB
GET JSR UbTl'lY
3F40 95E8
STA DATA.X
3F42 ES
OK
3F43 E004
CPX #$04
3F45 D0F6
ENZ GET
3F47 A200
UK #$00
3F49
jBEMOVE 2 HIGH BITS OF LOBKTE
3F49 16E8
SHUT ASL DATA.X
3F4B leES
ASL CATA.X
3F4D
[ROTATE BOTH BYTES RIGHT WITH CABBf
3F4D 76E9
FOR DATA+l.X
3F4F 76E8
RDR DATA.X
3F51 76E9
BOR DATA+l.X
3F53 76E8
BOR 1»TA,X
3F55
jCLEAR 4 HIGH BITS
3F55 B5E9
U» iaTA+l,X
3F57 290F
AND ♦%00001111
3F59 95ES
STA DRTA+l.X
3FSB ES
niK
3F5C E8
nax
3F5D E004
CPX #$04
3F5F DOES
BSE SHIFT
3P61
!M3VE DMA TO BASIC lOCATICHS X1%,Y1%
3F6X A002
Wl #$02
3P63 A200
UK #$00
3F65 B5E9
STXY U» DATAfl.X
3P67 9175
STA (VRFPTR),Y
3F69 C8
INY
3F6A B5E8
IDA DATA.X
3P6C 9175
STA (VAKl'rK),Y
3F6E 98
TYA
3F6F 18
dJC
3F70
rOFFSET FOR Yl%
3F70 6906
ADC #506
3F72 AS
T*y
3F73 E8
mx
3F74 E8
INX
3F75 E004
CPX #$04
3F77 DOEC
EKE STXy
3F79 60
BTS
3F7A
3F7A
loPEN WRITE F1I£-USR(1)
3F7A
3F7A A920
OPENWR UA #$20
3F7C 8D09A4
SVk GAP
3F7F
;SAVE PRINTER STAIUS
3F7F AD11A4
Ua PRIFLG
3F82 eD263F
siA psrar
3F85
;TAPE OR DISK?
3B85 2071E8
JSR VffiERBO
3F88
[PRINTER OFF
3F88 A900
PROTT U» #$00
3raA 8miA4
SIR PRIFLG
3F8D 60
RIS
3F8E
(Continued)
For some purposes it would be
preferable to operate a Bit Pad in stream
mode rather than in point mode. This
would let you trace an outline quickly
while the Bit Pad transmits data con-
tinuously to the AIM. It might be
preferable to use the 8-bit parallel inter-
face for this. I have used a Bit Pad with
the parallel interface (see Coyle, this
issue) on a trial basis, and have a
preliminary program to decode and
store coordinate pairs in this mode. It
would probably be best to use this as a
subroutine called in a machine
language program, because of speed
limitations inherent in BASIC. You
might want additional routines to find
such things as maxima, minima, arc
lengths, or areas, returning to a BASIC
calling program only with such
computed values, rather than with the
raw data.
I want to thank my associates, Jim
Laurino and Lee Peachey for advice.
References
1. Bresson, Steve. 1980. "AIM 65
BASIC Save/Load Scheme." 6502 Usei
Notes, No. 17, p. 20.
2. Flynn, Christopher. 1979.
"Some Important BASIC Mods." 6502
Usei Notes, No. 15, pp. 9-12.
3. Flynn, Christopher. 1980. "AIM
65 File Operations." MICRO, No. 26,
pp. 61-66.
4. Kvaal, Knut. 1980. "AIM BASIC
Files." The Target. January/ February
1980, pp. 2-3.
5. Saltero, Richard. 1980. "BCD
Input to a 6502 Microprocessor."
MICRO, No. 27, pp. 68-70.
Ralph O. Erickson is a Professor of Botany
at the University of Pennsylvania, and the
author of a number of articles in scientific
journals. Since 1964, he has had
experience with several computers in
connection with his research (IBM 7040,
360, 370; CDC 3600; PDP 10; H-P 9830;
Tektronix 5041). Currently, he is
enthusiastic about the potential and
convenience of microcomputers, such as
the AIM 65, for applications in scientific
research. He also uses his AIM for
recreation, such as playing music.
JMCftO
No. 38 -July 1981
MICRO - The 6502/6809 Journal
89
Listing 2 IContinued)
ai-BE
;CLOSE WRTIB FIIZ-USR(2)
3F8E
;
aifSE 2OF0E9
CDOSWR JSRCRIf
arei 20F0E9
JSR CRIF
ai'SA 20OAE5
JSR DOll
3Ii37 W513A4
Uft OWHC
31?9A C955
CMP 'U
3ir9C
;CLOEE DISK FXI£
33?9C FOCe
EEC PRSTftT
3IiW
.■njBN OFF REXDRIOTS
311^ A9CF
BEOXT LDA *$CF
3FA0 2D00A8
WD I3«B
3]l%3 8D0QA8
STA DRB
31iM
(RESTORE PRUnER SIRTOS
31!M AD263F
PRfflAT UA PSTAT
31^ 8D11A4
STA FRIFLQ
3nc 60
RTS
31!M
!
3]i7U>
lOFQ) READ FILE-USR(3)
3FKD
1
3irAD AD11A4
OPENRD Ii3A PKDL6
3]?B0
;SAVE PRUnCR SIPUVS
3IFB0 8D263F
STA PSTAT
3ire3
;TAPE OR DISK?
31!B3 2048E8
JSR VHEREI
3:FB6
rPRINIER OFF
3TB6 4Ca83F
JMF FR^T
3:fb9
;
3:EB9
;CL06E READ FII£-USR(4)
3FB9
;
3:FB9 AD12M
CLOERD lUA INCIX3
3:roc C955
CMP 'U
3:FBE D003
EME RECl
3:FC0 4C109E
JMPHEAECP
3PC3 20FEE8
RECl JSR II.
3FC6 4C9E3r
JHP RBOOFF
3PC9
I
3PXS
(REIURN TO KM1TOR-USR(5)
3PS
(
3FC9 4CUE1
MOtmt JMP CCKQI
END
MOftC SOFRUflRC TOOLT _^_
FROM H€S FOR VOUR 8K PJ^T
by Joy BalohrisiMan
HESEDIT : change 22 lines of data by merely over-
typing and insert, delete, and even duplicate lines-
all at once! Scroll forwards or backwards by any
amount— it's also easy to edit files bigger than your
memory. Why code a program to maintain each file?
Use HESEDIT for mailing lists, notes or prepare
assembler source for HESBAL. All keys repeat. FAST -
written in BASIC and assembler. ONLY $12.95
6502 ASSEMBLER PACKAGE: HESBAL, a full-featured
assembler with over 1200 bytes free (8K) & HESEDIT;
for less than $25! HESBAL is THE best 8K assembler
available: it uses only 1 tape or disk, yet includes
variable symbol sizes, pseudo-opcodes, over 25 error
messages and more than 70 pages of documentation.
ONLY $23.95
HESLISTER: formats multi-statement line BASIC
programs, shows logic structure (disk reqd.) $9.95
GUARANTEED to load or replaced FREE
Order from your dealer or direct from us
Plus $1.50 Postage (our doc. is heavy!)
Disk - Add $3 . Calif Res. - 6% Sales Tax
Humon engineered Softijuare
3748 ingleujood Blvd. Room 1 1
Los Angeles, ColifornlQ 90066
24 HOURS - (213) 398-7259
Dealer inquiries wekomed
^?r.v ■■
Issue Numbsrs and Dates
MICRO .Summer Special .i ...
on Back issuss .
Offe' good ""i the USA only.
Good through September 30, 1981.
Order any combination of available back issues.
Prices include surface shipping charges.
1 - 3 copies
4 or more copies
Regularly Special Price
$2.50 each $2.00 each
2.00 each 1 .25 each
Phone orders taken at MICRO headquarters for
VISA and Mastercard charges. Call (617)
256-5515 (9:00 to 5:00 Eastelti Time) or write
Order Department
MICRO
34 Chelmsford Street
P.O. Box 6502
Chelmsford, MA 01824
Issue
Volume
7
Volume 2
8
II
9
"
10
"
11
ft
12
II
13
Volume 3
14
II
15
II
16*
"
17
11
18
II
19*
"
20
"
21
"
22
"
23
"
24
It
25
Volume 4
26
"
27
"
28
"
29
"
30
M
31
"
32
"
33
"
34
'*
35
"
36
"
Date
Oct/Nov 1978
Dec/Jan 1978-79
Feb 1979
March "
April
May
June 1979
July "
Aug
Sept "
Oct
Nov "
Dec
Jan 1980
Feb "
March "
April
May "
June 1980
July "
Aug
Sept "
Oct
Nov
Dec "
Jan 1981
Feb "
March "
April
May
Issues 16 and 19 are out of print.
90
MICRO - The 6502/6809 Journal
No. 38 -July 19
MICftO
^PETVel
By Loren W. Wright
I had planned to do this column as a
comparison of assemblers for 8K PETs.
However, I have determined that there
is now only one widely available.
Personal Software withdrew its
"Assembler in BASIC" last fall, so the
remaining one is the newly-released
HESEDIT/ HESBAL from Human
Engineered Software.
The editor (HESEDIT), which can be
useful for editing files other than
assembly language source, is page-
oriented. Operation revolves aroimd the
command line at the top of the screen,
where commands are entered that
manipulate the file with respect to the
22-line display window. Other com-
mands, like Insert, Delete, and
eplicate, are entered in the numbered
(or command) portion of each line. It is
very easy to make changes anywhere in
the editor file. Also, a file larger than the
memory available can be manipulated.
Other commands save and load files on
tape or disk.
The assembler (HESBAL), written in
BASIC, is understandably slow. It does
the job, though, and you can assemble
to any available place in memory you
wish (not just the second cassette
buffer). Also, it is easy to make correc-
tions at the time of assembly. All you
need do is type a line (which includes
the corrected source line) in the
immediate mode, and you're back in
busiuess!
Probably the best part of the package
is the documentation. As part of the
"human engineered" concept, a full
BASIC listing and program description
are included. The manual suggests a
number of possible changes to suit in-
dividual needs. These include accom-
modatiog a printer and assembly in the
immediate mode, without a previously
prepared editor source file. As a service
|to its customers, a copy of the public
rdomain Micromon, an enhanced PET
monitor by Bill SeUer, is included.
No. 38 -July 1981
The slow speed of the assembler is a
function of BASIC vs. machine
language. A machine language assem-
bler would have taken longer to develop,
and hence would cost a lot more. It also
would be difficult to change. The
limited power (there are only four
pseudo-ops) of the assembler is also a
function of BASIC. There's only so
much that can be put into a program for
an 8K PET and still leave room enough
for the source, object, and symbol table.
The assembler does not print the ob-
ject as it assembles — only the program
counter and somce line. I'm not sure
whether this deficiency can be corrected
with a simple patch. My review copy of
the assembler mistakenly rejected the
"absolute, indexed by Y" mode. 'This
can be corrected with the addition of a
single BASIC line, and I assume the cur-
rent version includes this change.
Human Engineered Software's
HESEDIT/HESBAL is a very usable
editor/assembler for 8K PETs. As the
oniy such package currently widely
available, it has filled a void in the
market. Owners of larger PETs might
consider this over faster, more powerful,
but considerably more expensive
packages. The well-documented BASIC
program is easy to change to fit a
number of special needs.
HESEDIT is available in three ver-
sions — one for each ROM set — for
$12.95 on tape or diskette. HESBAL,
with HESEDIT, is $23.95.
Symbolic Assembler for HESEDIT/
HESBAL
Before I stray too far from this sub-
ject, I should mention that Emil
Volcheck has made changes in Werner
Kolbe's Symbolic Disassembler
(MICRO 32:23) to make it compatible
with HESEDIT/HESBAL. Other
changes include a greater "user-
friendliness" and an additional disk
filing routine. He is willing to supply a
cassette copy, with listing, for $5.00
postpaid.
Emil J. Volcheck, Jr.
1046 General Allen Lane
West Chester, Pennsylvania 19380
BASIC Upgrade Update
In my overview of BASIC upgrades
(MICRO 36:62), I neglected to point out
that Palo Alto ICs offers an inexpensive
way to upgrade to its 4.0 Toolkit. Send
them your current Toolkit ROM, with a
MICRO -The 6502/6809 Journal
check for $22.45 postpaid, and you will
receive a 4.0 version for a lot less than
the $39.95 new purchase price.
Palo Alto ICs
2585 E. Bayshore Road
Palo Alto, California 94303
Name Change
Commodore Interface is the new
name for the Commodore Newsletter of
the PET Users' Club. The first issue,
imder the editorship of Joe Devlin, in-
cludes a number of product armounce-
ments, (with a feature of the VIC-20),
news items, a couple games, program-
ming tips, and software and book
reviews. Future issues will be larger,
with the addition of advertising. Con-
tributions are encouraged. The aimual
$15 subscription ($25, Canada and Mex-
ico) covers six issues. For more informa-
tion, contact:
The Editor
Commodore Interface
681 Moore Road
King of Prussia, Pennsylvania
19406
Micro-Mainframe —
New from Commodore
Commodore has joined the 6809 band-
wagon with the introduction of its
Micro-Mainframe computer (also
known as "Super PET"). A demonstra-
tion unit was exhibited at the Commo-
dore booth at the National Computer
Conference in Chicago, May 4-7.
Actually, it is an 8032 with a 6809-based
64K expansion board, and yes, you will
be able to upgrade an existing 8032. The
Micro-Mainframe will support inter-
preted versions of BASIC, Pascal, FOR-
TRAN, APL, and soon, COBOL, all
developed at the University of Waterloo,
Waterloo, Ontario.
The Micro-Mainframe can operate as
a stand-alone microcomputer, support-
ing all CBM/PET software and hard-
ware (except C2N cassette), or as a
development system for larger and faster
mainframe computers. The 6809 board
includes a standard RS-232C interface,
and files are output in trae ASCII, a
form compatible with the mainframe
computers.
The $1995 price will include the
8032 computer, 6809 board, and soft-
ware, notably the "Waterloo 6809
Assembler and Linker." Deliveries are
scheduled for late 1981.
91
f?
©KID© ©©DIMTD^O©'©
SMALL SYSTEMS JOURNAL
7/7/s month's journal presents the conclusion
of "User-Defined Routines In UCSD Pascal" by
D.R. Turnldge.
F. PROGRAM SPECIALDEMO
This section contains a sample Pascal pro-
gram which illustrates the use of the procedures
in UNIT SPECIALFEATURES. The procedures from
the newly installed UNIT SPECIALFEATURES will
automatically be linl<ed into the worl^fiie when it is
run.
(*$L CONSOLE:*)
PROGRAM SPECIALDEMO;
USES SPECIALFEATURES;
VAR CHARNUM,XCOOR,YCOOR,COUNT,
LEFT,RIGHT,TOP,BOTTOM: INTEGER;
C0L0R,C0L0R2: COLORS;
PROCEDURE DELAYfTlME: INTEGER) ;
VAR C0UNT1,C0UNT2: INTEGER;
BEGIN
F0RC0UNT1: = 1 TO TIME DO
FOR C0UNT2: = 1 TO 50 DO (* WAIT A WHILE *) ;
END;
PROCEDURE WHISTLE;
VAR FREQUENCY.JNC: INTEGER;
BEGIN
SOUNDON; (* TURN SOUND OPTION ON *)
FREQUENCY: = 256;
FILLCOLOR(BLUE);
XCOOR: = 0; YC00R: = 1; INC: = 1;
REPEAT
TONE(FREQUENCY);
FREQUENCY: = FREQUENCY + 2;
PLOTC0L0R(INVBLUE,XC0OR,YC0OR) ;
IF INC =1 THEN
IFXC00RO1THEN
XCOOR: = XCOOR + INC
ELSE
BEGIN
INC:= -1;
YC00R: = YC00R + 1;
END
ELSE
IFXCOOR>0THEN
XCOOR: = XCOOR + INC
ELSE
BEGIN
INC: = 1;
YC00R: = YC00R + 1;
END;
UNTIL FREQUENCY = 2048;
INC:=-1;
REPEAT
TONE(FREQUENCY) ;
FREQUENCY: = FREQUENCY - 2;
PLOTCOLOR{BLUE,XCOOR,YCOOR) ;
IF INC = 1 THEN
IFXC00RO1THEN
XCOOR: = XCOOR + INC
ELSE
BEGIN
INC:= -1;
YCOOR: = YCOOR-1;
END
ELSE
IF XCOOR>0 THEN
XCOOR:=XCOOR + )NC
ELSE
BEGIN
INC: = 1;
YC00R: = YC00R-1;
END;
UNTIL FREQUENCY = 256;
END;
BEGIN (* PROGRAM SPECIALDEMO *)
INITOPTiONS; (* INITIALIZE OPTIONS *)
CLEARGRAPHICS; (* CLEAR GRAPHICS DISPLAY *)
CLEARCOLOR; (* CLEAR COLOR DISPLAY *)
COLORON; (*TURN COLOR OPTION ON*)
COLOR: = YELLOW;
FOR CHARNUM: = to 47 DO
BEGIN
FILLGRAPHICS(CHARNUM) ;
SCR32 X 64;
FILLCOLOR(COLOR) ;
DELAY{25) ;
COLOR: = SUCC(COLOR) ;
SCR32X32;
FILLCOLOR(COLOR) ;
DELAY(25) ;
COLOR: = SUCC(COLOR);
END;
CLEARGRAPHICS;
C0L0R2:= YELLOW;
REPEAT I
FILLC0L0R(C0L0R2) ;
(* DISPLAY COLOR CHECKBOARD SPIRALING OUT *)
LEFT: = 15; RIGHT: = 16; BOTTOM: = 15; TOP: = 16;
REPEAT
FOR YCOOR:= BOTTOM TO TOP DO
BEGIN
PLOTCOLOR(COLOR,LEFT,YCOOR) ;
COLOR: = SUCC(COLOR) ;
END;
FOR XCOOR: = LEFT + 1 TO RIGHT DO
BEGIN
PLOTCOLOR(COLOR,XCOOR,TOP) ;
COLOR: = SUCC(COLOR) ;
END;
FOR YCOOR:= TOP-1 DOWNTO BOTTOM DO
BEGIN
PLOTCOLOR(COLOR,RIGHT,YCOOR) ;
COLOR: = SUCC(COLOR) ;
END;
FOR XCOOR: = RIGHT- 1 DOWNTO LEFT +1 DO
BEGIN
PLOTCOLOR(COLOR,XCOOR,BOTTOM) ;
COLOR: = SUCC(COLOR) ;
END;
LEFT: = LEFT-1; RIGHT: = RIGHT +1;
BOTTOM: = BOTTOM - 1 ; TOP: = TOP + 1 ;
UNTIL LEFT = 2;
(* DISPLAY GRAPHICS CHARACTERS SPIRALING IN
LEFT: = 3; RIGHT: = 28; TOP: = 28; BOTTOM: = 3;
CHARNUM: = 0;
REPEAT
FOR YCOOR: = BOTTOM TO TOP DO
BEGIN
PLOTCHARACTER(CHARNUM,LEFT,YCOOR);
CHARNUM: = CHARNUM + 1;
END;
f
OHIO SCIENTIFIC 1333 S. Chilllcothe Road • Aurora, Ohio 44402 • (216) 831-560
5 fl
92
MICRO - The 6502/6809 Journal
No. 38 -July 1981
Adveitisement
FOR XCOOR: = LEFT + 1 TO RIGHT DO
BEGIN
K. PLOTCHARACTER(CHARNUM,XCOOR,TOP) ;
('§ CHARNUM: = CHARNUM + 1;
^END;
FOR YC00R:=T0P-1 DOWNTO BOTTOM DO
BEGIN
PLOTCHARACTER(CHARNUM,RIGHT,YGOOR);
CHARNUM: = CHARNUM + 1;
END;
FOR XCOOR: = RIGHT - 1 DOWNTO LEFT + 1 DO
BEGIN
PLOTCHARACTER(CHARNUM,XCOOR,BOTTOM);
CHARNUM: = CHARNUM + 1;
END;
LEFT: = LEFT + 1; RIGHT: = RIGHT -1;
TOP: = TOP - 1 ; BOTTOM: = BOTTOM + 1 ;
UNTIL LEFT = 16;
DELAY(50) ;
(* ERASE GRAPHICS CHARACTERS SPIRALING OUT *)
LEFT: = 15; RIGHT: = 16; BOTTOM: = 15; TOP: = 16;
REPEAT
FOR XCOOR: = LEFT TO RIGHT DO
ERASECHARACTER(XCOOR,BOTTOM) ;
FOR YCOOR: = BOTTOM + 1 TO TOP DO
ERASECHARACTER(RIGHT,YCOOR) ;
FOR XCOOR: = RIGHT- 1 DOWNTO LEFT DO
ERASECHARACTER(XCOOR,TOP) ;
FOR YCOOR: = TOP -1 DOWNTO BOTTOM + 1 DO
ERASECHARACTER(LEFT, YCOOR) ;
LEFT: = LEFT - 1 ; RIGHT: = RIGHT + 1 ;
TOP: = TOP + 1; BOTTOM: = BOTTOM -1;
UNTIL LEFT = 2;
(* ERASE COLORS SPIRALING IN *)
LEFT: = 3; RIGHT: = 28; TOP: = 28; BOTTOM: = 3;
REPEAT
FOR XCOOR: = LEFT TO RIGHT DO
ERASECOLOR(XCOOR,BOTTOM) ;
OR YCOOR: = BOTTOM + 1 TO TOP DO
ERASECOLOR(RIGHT,YCOOR) ;
FOR XCOOR: = RIGHT -1 DOWNTO LEFT DO
ERASECOLOR(XCOOR,TOP) ;
FOR YCOOR: =TOP - 1 DOWNTO BOTTOM + 1 DO
ERASECOLOR(LEFT, YCOOR) ;
LEFT: = LEFT + 1; RIGHT: = RIGHT -1;
TOP: = TOP - 1 ; BOTTOM: = BOTTOM + 1 ;
UNTIL LEFT =16;
C0L0R2: = SUCC(SUCC(C0L0R2)) ;
COLOR: = SUCC(COLOR) ;
INTILC0L0R2 = OLIVE;
LEARGRAPHICS;
fHISTLE;
IITOPTIONS; (• REINITIALIZE OPTIONS *)
/P
ND.
libliography
Bowles, Kenneth L., Beginner's Guide to the
UCSD Pascal System, Peterborough: Byte
Books, 1980.
Fox, David & Waite, Mitch, Pascal Primer,
Indianapolis: SAMS.
. UCSD Pascal User's Manual, San Diego:
Softech microsystems, 1978.
. UCSD Pascal Supplemental User's Document
(or Use with the Ohio Scientific C3, C4 and 08,
an Diego: Softech microsystems, 1980.
\LL 1-800-321-6850 TOLL FREE
Make Your
Reference Library
Complete With
The Best of MICRO
Volume 1— Contains 46 articles from
October/November 1977 through
August/September 1978: Apple articles
(16), AIM 65 (1), KIM-1 (10), PET (9), OS!
(1), SYM-1 (1), and General (8). 176
pages plus 5 tear-out reference cards
(Apple, KIM, PET, and 6502), 81/2 X 11
inches, paperbound. $6.00
Volume 2— Contains 55 articles from
October/November 1978 through May
1979: Apple articles (18), AIM 65 (3),
KIM-1 (6), PET (12), OSI (3), SYM-1 (4),
and General (9). 224 pages, 8 1/2 x 11
inches, paperbound. $8.00
Volume 3— Contains 88 articles from
June 1979 through May 1980: Apple
articles (24), AIM 65 (7), KIM-1 (9), PET
(15), OSI (14), SYM-1 (11), and General
(8). 320 pages, 8^2 x 11 inches,
paperbound. $10.00
Ask for The Best of MICRO at your
computer store. Or, to order with VISA
or Mastercard
Call TOLL-FREE
800-227-1617
Extension 564
In California 800-772-3545
Extension 564
On orders received by August 31 , 1981 , we pay
all surface shipping charges. Massachusetts
residents add 5% sales tax.
34 Chelmsford Street
P.O. Box 6502
Chelmsford, MA 01824
38 -July 1981
MICRO - The 6502/6809 Journal
93
^-~>«.
BATAOOtECTOR.I
The
Data
Director
easy to use Professional Software for
easy to get Professional Results
THE DATA DIRECTOR PROJECT
The Data Director is a file management system
designed for associations, direct mailers, sales &
marketing departments, recruiters, and companies
that have the following profile:
• Maintain 1 to 5 files on paper or through a
service bureau.
• Files are the heart of your operation
(membership lists, subscription lists, sales
inquiries, resumes, etc.).
• First time computer user.
• Staff characterized by high turnover.
• One major task associated with each file.
Renewals, mailing labels, Inquiry response,
regular peak periods, etc.
The system is based upon work that began on
Burroughs mainframe computers in the mid-1970s.
In 1979 it was installed on OSI computers at four
carefully selected alpha-test sites. These sites
ranged from a church in a Gary, Indiana ghetto to
the fourth-ranked graduate business college in the
nation. One site, a direct mail service in Chicago,
entered over 300,000 names and addresses into
their system during 1979 and 1980.
Before a line of code was written, we profiled the
average operator. He/she was a high school
graduate, an average typist, low paid, low seniority,
filling a high-turnover position. How could we work
with this person?
We began by isolating the disk operating system,
thereby reducing the training time and the chances
of a costly mistake. The system includes a diskette
formatter, file-to-file copier, directory report, file
create, file rename, file delete, disk packer, and
diskette copier. It traps disk errors and displays
error messages in English. For example, an open
disk drive prompts the message, "Drive door open.
Close door and try again."
Next we developed a machine language terminal
controller to simplify data entry. Displays are
paged, not scrolled. Records are presented as
forms automatically. If your terminal offers it, we
use full and half intensity to highlight data, and
cursor control keys to move around the display. We
emulate all the features found on the most expen-
sive terminals— character insert/delete,
forward/reverse tab, field erase, strike-over,
rubout, etc. Existing data is edited, not retyped.
The bottom line of each display is reserved as a
status and command line. The operator uses a
vocabulary of 30 English command words to begin
each task. For example, ADD adds a new record to a
file, REBUILD reconstructs an existing file into a
new format. SORT sorts a file on up to 5 keys in
ascending or descending order for each key.
Help is available on-line through a HELP dic-
tionary which explains the purpose and function of
each command in the vocabulary.
A 225-page manual thoroughly documents
system operation, and supplies additional informa-
tion to get you started properly.
HARDWARE REQUIREMENTS
Computers: C2-0EM, C2-D, and all C3 models
running under the 0S-65U operating system. Data
Director II and III support up to 8 users.
Terminals: All 24 by 80 cursor addressable
terminals are supported. Models are selected from
a menu. Multi-user systems may use different
terminal models at each station.
Printers: All printers supported by the 0S-65U
V1.2 DOS. Printers are selected from a menu. Line
and page lengths are establish globally.
THE DATA DIRECTOR I
Our base system is optimized for floppy disk
systems. Records may contain up to 99 fields of
information. Each field may contain up to 71
characters. Three field types are recognized alpha,
numeric, and MM/DD/YY dates.
Existing OS-DMS compatible files can be read
and maintained by the system (although the
reverse is not true). We hope that OS-DMS users
will consider upgrading to our system.
The REPORTS command offers an inquiry report
that can be sent to the console or printer, a mailing
label generator, and a conditional report writer with
statistical analysis. All reports, and most of the
utilities, feature a program halt on CTRL-C which
allows you to halt the report and abort or continue
at your leisure.
THE DATA DIRECTOR II
Although it runs on a floppy disk system, our
second system is optimized for a hard disk system.
It supports up to 8 users (16 upon request), and
was designed for files up to 20,000 records long. All
version I features are incorporated.
The operating system utilities are extended to
include a fast floppy dumper to back up hard disk
files to floppy diskette. (Mag tape support is
available separately.)
A duplicates report scans files for duplicate
records. As an option, it can count all the oc-
currences of a duplicate field, like breaking down
zipcode distributions.
The report saver captures report definitions and
saves them by name. Our users have defined
reports with exotic names like "In Work," "Delin-
quents," "Approved Loans," "Past Due," and "Prod
Work Orders." The reports offer conditional selec
tion and statistical analysis.
The mailing label generator is expanded into ;
complete subsystem aimed at professional mailers
The operator defines a label definition, giving it ;
name, the label's size, fields which are to appear oi
it, messages like "After 5 days return to." and evei
default values like "Occupant" that are to appear i
the data is missing. By selecting a definition, thi
operator can print on pressure sensitive labels
envelopes, 3 by 5 cards, stationery, etc. Prin
options include printing labels 1 to 5 across am
repeating labels up to 99,999 times.
THE DATA DIRECTOR III
Our top of the line system is designed for ver
large files, 20,000 to 100,000 records long. I
incorporates all of the features of versions I and I
and adds a new "linked list" storage technique.
From the operator's viewpoint, a linked fil
appears to be resorted automatically whenever
record is added or deleted. A file can be ordered ii
up to 5 different ways. For example, you coul^
order a membership roll by (1) zipcode, (2) zipcod
and name, (3) name, (4) renewal date, and (5) se)
age, and marital status.
Seek times are vastly reduced. You could fin
the first occurrence of renewal date 11/01/81 in
100,000 record file in under 6 seconds, the
switch keys and browse forward or backwar
through the file by name.
CONSIDER THESE FACTS
It costs money to put data into a computer. As
rule of thumb, expect to pay $125 per 100
records in labor just to gather and key in yourdat;
Ask any data processing professional; in less tha
two years your data will be worth more than th
cost of your computer and software combined. Thi
is without consideration of cost savings or ac
ditional income you can generate with the use i
this information. You need the best software on th
market to look after that asset.
Data Director I $ 495.00
Data Director II $ 995.00
Data Director III $1995.00
Manuals $ 30.00
Dealer inquiries invited.
Basic Business Solutions, Inc.
831 N, 3rd Ave.
St. Charles, IL 60174
Bus. Offices (312) 377-0813
Support Center (312) 746-8736
94
MICRO - Tfie 6502/6809 Journal
No. 38-July19£
'^
i
M\R. W^" presents our valuable free
catalog (over 100 pages). He PROMPTS you
to PEEK at the latest collection of
software and hardware
products for your APPLE II
"^
TM
A STELLAR TREK
the definitive Hi-Res
color version of the ciassic
startrei< game. Three
different Kilngon opponents.
iwanv command prerogatives
from use of weapons to
repair of damages. Needs
48K Applesoft ROIVI.
DiSl<...S24.95
VERSAWRITER II
A drawing tablet,
simply plUgs into your
game I/O port. Trace, draw,
design, or color any type of
graphic. Adds words to
pictures, creates schematics.
Computes Distance/Area of any
figure. New - fill any area
on the screen in seconds with
over 100 different and
distinct colors. Needs 32K
Applesoft ROM and disk
drive. A bargain at.
$249.95
BOWLING DATA
SYSTEM
This data mangement
program provides accurate
record keeping and report
generation for bowling leagues
of up to 40 teams with
6 bowlers per team.
Needs 80-column printer,
S2K Applesoft ROIVI.
Disk... $79.95
SUPER SOUND
Musical rhythms,
gunshots, sirens, laser blasts,
explosions . . .add these and
many more exciting
sounds to your Apple, use
them in your programs,
or create your own
SUPER SOUNDS. Needs
16K Applesoft.
Have a blast for only
$12.95... Tape
$16.95... Disk
ADDS2.00U.S. 510.00 FOREIGN FOR SHIPPING
CALIFORNIA RESIDENTS ADD 6% SALES TAX
Don't see what you want
here, then write or call
today for your free
catalog, we're saving
one just for you.
Visa/Mastercharge welcome.
Open Tues. -Sun.
GARDEN PLAZA SHOPPING CENTER
9719 RESEDA BOULEVARD DEPT. 1MI
NORTHRIDGE, CALIFORNIA 91324
PHONE (213) 349-0300
No. 38 -July 1981
MICRO - The 6502/6809 Journal
95
What's Where
in The Apple ?
An Atlas to the Apple Computer
By William F. Luebbert
Adjunct Professor of Engineering,
Dartmouth Coiiege
President, Computer Literacy Society
Tliis definitive programmer's guide
to the Apple II describes all the
hardware and firmware
characteristics important to
programmers, including over 2,000
memory locations. The book
expands upon the author's highly
popular article published in MICRO,
The 6502 Journal (15:36, August
1979).
What's Where in the Apple? allows
users — frustrated by the
limitations of BASIC — to take
advantage of the full power of the
Apple II system. The book enables
users to move easily and gradually
from beginning BASIC to advanced
programming techniques — without
making an abrupt transition from
BASIC to assembly or machine
language.
Approximately 192 pages, 8V2 x 11
inches, cardstock cover and Wire-0
binding.
Publication: August 1981 $19.95*
('After Sept. 30, 1981, add $2.00 for surface shipping)
(Massachusetts residents add 5% sales tax )
24-hour Order Service To order call Toll-free:
800-227-1617 Ext. 564
In California call 800-772-3545 Ext. 564
Igr
H
VISA and Mastercard Accepted
iMCftO
34 Chelmsford Street
P.O. Box 6502
Chelmsford, MA 01824
^'1
96
MICRO - The 6502/6809 Journal
No. 38 -July 1981
#
Please take a moment to complete this questionnaire, it wiii lielp MICRO and its advertisers to serve you better.
You
A. Age: B. Occupation:
C. Professional Computer Experience:
D. Computer Courses/Training:
E. Microcomputer Hardware Level: Novice Intermediate
F. MicrocomputerSoftware Level: Novice Intermediate
Your Systeni(s)
G. Indicate which systems you have access to on a regular basis by placing an
"0" for Other.
AIM Apple Atari KIM OS! PET/CBM
, Expert
Expert
'H" for Home, "W" for Work,
.SYM
Other 6502 Microcomputers (list):
H. Please answer for your own personal system(s): Type:
RAM Memory: K ROM/EPROM:
Disk drives: 5'/*": 8": .
Other Peripherals:
.6809 Microcomputers:
Printer:
.Video Monitor:
. Modem:
I. Estimate dollars you will spend in coming year for hardware: $ For:
Software and Applications
J. Estimate percent of software regularly used in each language:
Assembly: % BASIC: % Pascal: % FORTH: % Other: %
K. Estimate percent of time spent in each type of application:
Games: % Education: % Business: % Programming:
Scientific: % Engineering: % Other:
L. Estimate dollars you will spend in coming year for software: $ For:
M. How many hours per month do you spend In the following microcomputer activities?
Using Computer: Programming: Reading Computer Material: _
Computer Clubs: Computer Store: Computer Shows:
Other Computer Activities:
You and MICRO
N. Rate the value of MICRO departments on a scale of 1 (most valuable) to 5 (least):
Bibliography:
Software Catalog:
Micros in Medicine (Column): .
.Club Circuit:
. Hardware Catalog:
. New Publications:
.PET Vet (Column):
.Challenges (OSI Column):
.Editorial:.
. Letterbox:
Rate your preference for types of articles from 1 (most valuable) to 5 (least):
General Hardware: Microcomputer-specific Hardware:
General Software: Microcomputer-specific Software:
Applications: Tutorials: Programming Techniques:
BASIC Programs:
Other:
.Assembly Programs:
. Pascal Programs:
P. What kind of 6809 coverage would be most useful to you?
0. Where did you get your current copy of MICRO? Subscription:
Computer Store: Library:
.Computer Club:
R. If you are a subscriber, when did your subscription start?
S. If you buy MICRO at a computer store, how regularly do you buy it?
Monthly: Occasionally:
T. What would make MICRO more valuable and/or interesting?
.Borrowed:
. Rarely:
Please indicate what other microcomputer magazines you normally read:
S = Subscriber, P = Purchase regularly, O = Buy occasionally
BYTE Compute! Creative Computing
KB Microcomptuing Nibble On Computing .
Others (list):
.Interface Age
. Personal Computing
V. Please use this space and space on back for any additional comments and/or suggestions.
Return address not necessary.
Please fold here.
i'
MICRO
34 Chelmsford Street
P.O. Box 6502
Chelmsford, MA 01824
USA
^Pi^rv^' F-^-
/MCftO
^^ Classifiecl
Timestack — A Programmable
Controller
Expand your KIM-1 into a general-purpose
machine. 80-page manual documents
Clock/Port/RAM/PROM Expansion
Board and controller software. Subroutine
library includes user interaction routines,
I/O, and clock controls. Complete manual
— $15.00. SASE for more information and
newsletter.
Hunter Services
P.O. Box 359
Elm Grove, Wisconsin 53122
Atari Game Owners
Turn your Video Game Console into a
6502 microcomputer with our MagiCard.
Write programs using your keyboard con-
trollers, with full access to Atari video
capabilities. Includes IK bytes RAM,
ROM monitor, disassembler, instruction
manual, cassette interface plans. Send
$49.88 (Illinois add 6%) to:
Computer Magic Inc.
P.O. 3383M
Fox Valley Center
Aurora, Illinois 60505
Turnkey Medical Billing System
Interactive data entry. Automated file
management. Outputs: Patient state-
ments. Universal Claim Forms, financial
reports. Customized by user-developed
text files. Requires Apple, Applesoft,
printer. One disk drive manages 150
accounts; 2 drives— 400 accounts. $350 for
programs and 25 pages documentation.
Jerome B. Blumenthal, M.D.
7500 E. Hellman
Rosemead, California 91770
Used Micro Listing Service
Save time, money, mistakes, frustration.
Buyer/Seller — Apple, PET, OSI, CP/M
systems, floppies, printers — all equip-
ment $300 and up. Pay only for results.
Get thorough advice and listings over the
phone. Call now: 800-327-9191 x 61 or
703-471-0044.
Used Computer Exchange
2329 Hunters Woods Plaza
Reston, Virginia 22091
PET/CBM Owners
Real world software at low cost. 2114
RAM adapter and 4K Memory Expansion
for "old" 8K PETs. Write for free catalog!
Optimized Data Systems
Dept. M, Box 595
Placentia, California 92670
Spanish Hangman
2,000 SPANISH words and sentences
taught in a fun way on the Apple. Send for
your school's free 30-day evaluation
diskette, from:
George Earl
1302 South General McMullen
San Antonio, Texas 78237
AIM-65 Newsletter * * Target
Target provides hardware and software
information useful for AIM-65 and 6502
users. The 1979 and 1980 back issues are
available for $12.00 while a continuing
subscription costs $6.00. Just write to:
Target
Donald Clem
Route 2
Spenserville, Ohio 45887
C1P Extended Monitor
2K EPROM has 14 cursor control/editing
functions, improved keyboard decoding.
Machine language save, load, display,
modify, move, breakpoint processing and
much more. For 24, 32, 64 char/line.
$39.95 plus $1.00 shipping. $1.00 for
complete information.
Bustek
P.O. Box A
St. Charles, Missouri 63301
Ohio Scientific C1P, C4P COLOR
Earthship has GREAT programs. CIP, C4P
— Animated Limar Lander, Catchword,
real-time Scrabble, graphics designer,
analytical plotter, single disk copier; CIP
— animation and shape table graphics,
BASIC tutor, add and multiply tutor,
information processing simulation and
tutor. Send for catalog.
Earthship
17 Church Street #28
Nutley, New Jersey 07110
m
EDIT 6502
T:*. UK
Pass Assembler, Disassembler, and Editor Single Load Program
DOS 33., 40/80 Columns, for Apple II or Af^le II Plus*
A MUST FOR THE MACHINE LANGUAGE PROGRAMMER. Edit 6502' is a two pass Assem-
bler, Disassembler and text editor for the Apple computer. It is a single load program
that only occupies 7K of memory. You can move freely between assembling and disas-
sembling. Editing Is both character and line orientated, the two pass disassemblies
create editable source files. The program Is so written so as to encompass combined
disassemblies of 6502 Code, ASCII text, hex data and Sweet 16 codB. Edit 6502 makes the
user feel he has never left the environment of basic. It encompasses a large number of
pseudo opcodes, allows linked assemblies, software stacking (single and multiple
page) and complete control of printer (paganation and tab setting). User is free to
move source, object and symbol table anywhere in memory. Requirements: 48K of
RAM, and ONE DISK DRIVE. Optional use of 80 column M&R board, or lower case availa-
ble with Paymar Lower Case Generator.
TAKE A LOOK AT JUST SOME OF THE EDITING COMMAND FEATURES. Insert at line » n Delete a character
Insert a character Delete a line It n List line » nl, n2 to line » n3 Change line It nl to n2 "stringl" Search
line t nl to n2 "stringl".
LJK Enterprises Inc. P.O. Box 10827 St. Louis, MO 63129 (314)846-6124
*Eilit 6902 T.M. ol LJK EnL Inc. — 'Apple TM. ol Apple Computer Inc.
LOOK AT THESE KEY BOARD FUNCTIONS: Copy to the end ot line and
exit: Go to the twginning ol the line: abort operation: delete a
character at cursor location: go to end ol line: find character
after cursor location: non destructive backspace: insert a
character at cursor location: shift lock: shift release: forward
copy: delete line number: prefix special print characters. Com-
plete cursor control: home and clear, right, left down up. Scroll a
line at a time. Never type i line minber igiiii.
All Ihli and much much mere — Send far FREE Inlormition.
Intnxluctoiy Price $50.00.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
97
we carry it all
Atari'' Software
VisiCalc 1 49
CX4101 Invitation to Programming 1 .. 17
CX41 04 Mailing List 17
CX4102 Kingdom 13
CX41 03 Statistics 17
CX4105 Blackjack 13
CX4106 Invitation to Programming 2 . . 20
CX41 07 Biorhythm 13
CX4108 Hangman 13
CX41 09 Graph It 17
CX41 1 1 Space Invader 17
CX41 10 Touch Typing 20
CX4115 Mortgage & Loan Analysis.... 13
CX4116 Personal Fitness Program.... 13
CX41 17 Invitation to Programming 3 . . 20
CX41 1 8 Conversational French .... 45
CX41 1 9 Conversational German 45
CX41 20 Conversational Spanish 45
CX4121 Energy Czar 13
CX4125 Conversational Italian 45
CX81 08 Stock Charting 20
CXL400 1 Educational System Master . . 21
CXL4002 BasicComputing Language . . 46
CXL4003 Assembler Editor 46
CXL4004 Basketball 30
CXL4005 Video Easel 30
CXL4006 Super Breakout 30
CXL4007 Music Composer 45
CXL4009 Chess 30
CXL40 10 3-D Tic-Tac-Toe 30
CXL401 1 Star Raiders 33
CXL401 5 TeleLink 20
Talk & Teach Coursevi/are:
CX6001 to CX601 7 23
everything for Commodore
and Atari
AtarP Peripherals:
400 16K $349
410 Recorder 59
810 Disk 469
815 Disk 1199
822 Printer 359
825 Printer 629
830 Modem 1 59
850 Interface Module 1 39
Atari® Accessories
0X653 16KRAM 89
CX70 Light Pen 64
CX30 Paddle 18
CX40 Joystick 18
CX86 Printer Cable 42
C01 6345 822 Thermal
Printer Paper 5
CA01 6087 825 80-col.
Printer Ribbon
(3/box) 17
Microtek 1 6K RAM 79
Microtek 32 K RAM 179
Bcommodore
VIC-20 $ 279
4032N 1080
8032 1499
CBM 4022 Printer 669
CBM 4040 Drive 1039
CBM 8050 Drive 1 449
CBM C2N Drive 87
PET-IEEE Cable 37
IEEE-IEEE Cable 46
A
ATARI 800"
with 32K RAM
Disks
Maxell Disks 1 for $36
Syncom Disks 10 for 29
Atari Disks 5 for 22
only $759
Printers
NEC 5530 2495
Diablo 630 21 95
Trendcom 100 299
Starwriter $1 495
Trendcom 200 489
Paper Tiger 445G 769
Paper Tiger 460G 1219
Epson MX-80 499
Tally8024 1699
Software
EBS Accounts Receivable
Inventory System $595
OZZ Information System 329
BPI General Ledger 329
Tax Package 399
Dovif Jones Portfolio Management . . 129
Pascal 239
WordPro 3 (40 col.) 1 86
WordPro 4 (80 col.) 279
WordPro 4 Plus (80 col.) 339
Wordcraft 80 319
No Risk
Please Call Between 11AM & 6PM
(Eastern Standard Time)
(800) 233-8950
No Deposit On
Phone Orders -
COD or
Credit Card -Shipped Same Day You Call*
Prepaid Orders Receive Free Shipping
* on all in stock units
Computer Mail Order 501 E. Third St., Wllliamsport, PA 1 7701 (71 7) 323-7921
98
MICRO - The 6502/6809 Journal
No. 38 -July 1981
/MCftO
^ Hardware Catalog
Mike Rowe
P.O. Box 6502
Chelmsford, MA 01824
i
Name: Micto-Couriei
System: Apple H, Apple II Plus
Memory: 48K
Language: Integer BASIC or
Applesoft
Hardware: Apple U or Apple n Plus,
Monitor, Disk E with
controller, DOS 3.3, DC
Hayes Micromodem, a
"clock card," printer
with interface card.
Description: Allows owners of Apple n
and Apple n Plus desktop computers to
rapidly transmit charts, graphs, cor-
respondence, VisiCalc® reports and
entire programs to other Apple com-
puter owners. The transmissions can
be sent automatically, day or night, to
take advantage of late night phone
rates. Maintains phone lists and sorts
messages by individual user. Exchanges
data with time-sharing systems and
larger computers.
Price: $250.00 [suggested retail,
FOB Boston)
Available: Microcom, Inc.
89 State St.
Boston, Massachusetts
02110
i
Name: Hayes Stack Smart-
modem
System: Machine independent —
RS-232C compatible
Language: Program controlled in any
language
Hardware: Low speed modem
Description: RS-232C compatible, 300
baud data communications system for
small computers. Features program
control in any language, switch select-
able options, full or half duplex and
LED status indicators.
Price: $279.00
Available: Hayes Microcomputer
Products, Inc.
5835A Peachtree Comers
East
Norcross, Georgia 30092
(404) 449-8791
(Contact above address
for nearest retail dealer.)
Name: Bytewriter-l
Memory: One line buffer capacity
Language: BASIC
Description: 7 x 7 dot matrix, printer,
friction feed, 80 c.p.s., 60 1.p.m., inter-
faces Apple, Atari and TRS-80.
80-columns per line and double wide
character set.
Price: $299.00
Available: Microtek, Inc.
Name: The PEAR System
System: Apple
Memory: 48K
Language: Applesoft
Hardware: Dual SVt" disk drives,
DC Hayes micromodem,
32-column printer.
Description: PEAR is a multiple port-
folio recordkeeping and reporting
system for stockbrokers. Its imique file
structure means that securities infor-
mation is entered only once and can be
changed on all portfolios with a single
entry. PEAR includes automatic pricing
from Dow Jones, matching of proceeds
and cost basis by tax lot, automatic
adjustment of positions for stock splits,
portfolio appraisals, unrealized gain
and loss, realized gain and loss, invest-
ment income reports, and a full cross
reference listing of client holdings by
security.
Price: $500.00 includes
documentation and
program disk.
Author: Gregg Wilson
Available: PEAR Systems
27 Briar Brae Road
Stamford, Connecticut
06903
Name: PSSBC-A
System: AIM 65
Hardware: AIM 65 with BASIC and
Assembler ROMs
Description: Power supply built to the
specs for the AIM 65 including case
power cord cable to computer, switch,
fuse, pilot light, overvoltage protection.
Price: $64.95 plus shipping
(5 lbs)
Available: CompuTech
Box 20054
Riverside, California
92516
Name: Micromodem 100
System: S-100 Bus Computers
Hardware: Low speed modem
Description: Direct connect data com-
munications system for S-IOO bus com-
puters. Features 110 and 300 baud, full
or half duplex and programmable auto
dial and auto answer capabilities.
Price: $379.00
Available: Hayes Microcomputer
Products, Inc.
5835A Peachtree Comers
East
Norcross, Georgia 30092
(404) 449-8791
[Contact above address
for nearest retail dealer.)
Name: MEM 4 and MEM 8
System: AIM 65
Memory: 4K and 8K
Description: This is a low-power
memory board that is plug-compatible
with the AIM 65 expansion coimector
and requires no motherboard or other
hardware.
Price: $169.00 introductory
price for MEM 8 and
$109.00 introductory
price for MEM 4.
Available: System Peripherals
P.O. Box 971, Dept. M
Troy, Michigan 48099
Name: Datasouth DS180 Matrix
Printer
Description: 180 cps dot matrix impact
printer; bi-directional logic-seeking
printing for throughput from 75-425
lines per minute; standard features in-
clude serial and parallel interfaces, top
of form, perforation skipover, horizon-
tal and vertical tabs, non-volatile for-
mat retention, expanded print and self-
test. Options include graphics and APL.
Price: $1595 [OEM discounts
up to 40%)
Available: Datasouth Computer
Corp.
4740-A Dwight Evans Rd.
Charlotte, North Carolina
28210
and our distribuors
No. 38 -July 1981
MICRO - The 6502/6809 Journal
11
If
NIBBLE IS TERRIFIC
(Fop Youp Apple)
NIMLE IS: The Reference for Apple computing'.
MBBLEI8: One of the Fastest Growing new Magazines in
the Personal Computing Field.
NB8LEI8: Providing Comprehensive, UsefuLand
Instructive Programs for the Home, Small Business, and
Entertainment.
NIBBLE IS: A Reference to Graphics, Games, Systems
Programming Tips, Product News and Reviews, Hardware
Construction Projects, and a host of other features.
NIBBLE IS: A magazine suitable for both the Beginner and
the Advanced Programmer.
Each issue of NIBBLE features significant new Programs of Commercial Quality. Here's
what some of our Readers say:
- "Certainly the best magazine on the Apple 11"
- "Programs remarkably easy to enter"
- "Stimulating and Informative; So much so that this is the first computer magazine I've
subscribed to!"
- "Impressed with the quality and content ."
- "NIBBLE IS TERRIFIC!"
In coming issues, look for:
D Stocks and Commodities Charting D Assembly Language Programming Column
D Pascal Programming Column D Data Base Programs for Home and Business
D Personal Investment Analysis D Electronic Secretary for Time Management
D The GIZMO Business Simulation Game
And many many more!
NIBBLE is focused completely
on the Apple Computer systems.
Buy NIBBLE through your local
Apple Dealer or subscribe now with
the coupon below.
Try a NIBBLE!
NOTE:
hirsl Class or Air Mail is rcquir«<i for all APO. hPO and all IrJrrigo addresses
with the lollowingaddiiional amounts Africa: North $32.00
- Europs $32.00 Cantral $43.00
- Maxloo and Cantral America $21 .00 South $43.00
- South Amarfca $32.00 Far East, Australia $43.00
- Middle East $35.00 Canada $18.00
All' payments must be in U.S. funds drawn on a U.S. bank.
(J I9KI) by MICROSPARC , INC . Lincoln. Mass III77.1 All rights reserved
' Apple 1 1 is a registered trademark ol Apple Computer Company
nibble
Box 325, Lincoln. MA. 0177.1 (617)259-9710
I'll try niUile!
Enclosed is my $17.50 (for one year).
(Outside U.S., see special rates on this page.)
D Check D money order
Your subscription will begin with the next issue publisheo after
receipt of your check/money order.
Name .
Address^
City
State
. Zip-
i
100
MICRO - The 6502/6809 Journal
No. 38 -July 1981
Mike Rowe
P.O. Box 6502
Chelmsford. MA 01824
* Software Catalog
Name: Biostatistics
System: Apple II or Apple n Plus
Memory: 48K
Language: Applesoft BASIC
Hardware: Two Disk 11; Optional:
Printer and Watanabe
Miplot
Description: This is a collection of pro-
grams aimed at the researcher who re-
quires graphical representation and
analysis of data. The package performs
the following tests: Linear Regression,
Exponential Rejgression, Curvilinear
Regression, Data Plotting, Student t
Tests (paired and unpaired with
calculated probability), Mann-Whitney
U Test and Wilcoxon Paired Test. A
significant optional feature enables the
user to generate graphical output on the
Watanabe Miplot plotter. The package
includes both program and data disks
(DOS 3.2) as well as documentation.
Price: $40
Available: A2Devices
P.O. Box 2226
Alameda, California
94501
(415) 527-7380
i
Name:
System:
Memory:
Language:
Hardware:
Hebiew ipM
Apple n
48K
Applesoft in ROM or
Language System
Apple n with one disk
drive
Description: The first foreign language
word processor for the Apple II in
America. This program puts Hebrew
characters on the screen from right to
left (and numbers left to right in their
natural order) and allows full ctirsor
movement and character editing. Text
can be printed, saved to disk, and
recalled for further editing, which
makes it ideal for independent student
work. It is particularly useful for label-
ing any Apple Hi-Res page such as
charts, maps, and pictures. Hebrew II
can produce graph labels, press-on
labels, memos, posters, and, of course,
practice in learning Hebiew.
Price: $60
Available: Aurora Systems, Inc.
2040 E. Washington Ave.
Madison, Wisconsin
53704
No. 38 -July 1981
Name: DOW2000
System: Apple n
Memory: 32K
Language: Applesoft
Hardware: Disk 3.3/3.2 Printer
Option
Description: Stock Market Analysis
will determine price projections based
on a stock's BETA coefficient or
Relative Strength number and the Dow
Jones Average. Projections are made as
you vary the DOW. (What if....) On 1
stock or entire portfolio with single
scan, quick scan, or variable scan of
values. Included is the booklet "The
Art of Timing Your Stock's Next
Move." Author in market 17 years and
former registered Investment Advisor
with S.E.C.
Copies: Just released
Price: $29.00 with booklet
(booklet alone $6.00).
Author: CIAC: Calabrese
Available: BIT'N PIECES SERIES
P.O. Box 7035
Erie, Peimsylvania 16510
Name: CIP Animation and
Shape Table Graphics
System: OSI CIP cassette or
PICO DOS
Memory: 8K cassette, 20K disk
Language: BASIC and assembler
Description: The animation package
contains a BASIC program for drawing
from the keyboard, without any
numbers or programming, any number
of single page pictures which are
catalogued and POKEd into an indexed
shape table. They may be saved to tape
for later use. The following three
assembler routines are organized by a
short BASIC executive to give the user
the ability to do complex high speed
graphics and animations through sim-
ple BASIC programming. CLEAR:
Clear or fill any portion of the screen in
one page increments. PUTPIC: Call
any catalogued picttire to any part of
the screen. FLASH: Flash any portion of
the screen, or alternate between two
pictures.
Price: $22.95 cassette, $24.95
disk fully documented
Author: Ken Madell
Available: Earthship
17 Church St. #28
Nutley, New Jersey
07110
MICRO - The 6502/8809 Journal
Name: Disk Bowling System
System: PET/CBM
Memory: 32K (16K for smaller
version)
Hardware: PET with disk and
printer
Description: A complete scoring
system for bowling league secretaries.
Scratch and handicap bowling leagues
with up to 24 teams (smaller version
handles 12 teams). Features include
disk records, accuracy, and extensive
editing giving the secretary complete
control of the data. Provisions are in-
cluded for forfeits, blinds, partial
absences, snapout errors, postpone-
ments, team ties, individual ties, subs,
name changes, drops, ineligibles,
messages, display of secretary's lane,
and lane assignments anywhere in a
98-lane house. It is designed to be com-
plete and yet save paper costs. The
Epson option produces compacted
printing saving another 25%. A year-
end sweeper program that nms off of
the final data disk is available, as is a
complete archive program that will
read each week's disk record for data on
each individual.
Price: Starts at $40.00
Available: Harry H. Briley
P.O. Box 2913
Livermore, California
94550
Name: 5 Great Games!
System: Apple n
Memory: 48K
Language: Applesoft, Machine
Hardware: Apple II Plus, Disk n
Description: Includes Animal Bingo,
Jimgle Safari, Space Defense, Sky
Watch, and the unforgettable Air Traf-
fic Controller. These are our most
popular games — every one is Hi-Res,
chock full of shape tables, and full of
great machine language soimd effects
— some like you've never heard before.
There's enough action and intrigue to
keep you going for months!
Copies: Many
Price: $29.95 (or $9.95 for any
one of the above games) .
Includes game cards, two
disks, instructions.
Available: Avant-Garde Creations
P.O. Box 30161
Dept. MCC
Eugene, Oregon 97403
101
Name: Mini-Count
System: PET/CBM
Memoiy: 8K
Language: BASIC and machine code
Hardwiire: Connector and clip leads
Description: Uses the PET/CBM
parallel user port to measure frequency
and time intervals. Can also count
pulses. Many sophisticated featiures
such as auto-ranging, averaging, and
external stop/start signals. Frequency
limit of 17 Khz and pulse widths of 45
usee to 65.53 msec.
Price: $19.95 includes cassette
and manual
Author: Ralph D. Goff
Available: Optimized Data Systems
P.O. Box 595
Placentia, California
92670
Name: The Ultimate Catalog
Systemi: Apple n/ Apple n Plus
Memory: Minimum 20K
(ROM Applesoft)
Language: Applesoft and machine
RWTS
Hardware: Apple n, Disk n, DOS 3.2
Description: Now you can format your
directory to appear any way you wish.
Block similar programs together; write
headers mid-directory; separate by sec-
tions. This 5K, menu-driven utility is
easy to use and performs the following
fimctions: Alphabetize any portion or
all of directory, move any file, ex-
change any two files, highlight or
remove highlighting from any file
name, insert blank line(s), delete any
file, lock or imlock all files, delete or
restore all files.
Price: $6.50 for listing and
instructions
Author: Larry Abrams
Available: Aries Software
P.O. Box 58
Los Altos, California
94022
Name: Apple Alarm
System: Apple n with Firmware
Card or Apple n Plus
Memory: 48K RAM
Language: Applesoft DOS 3.2, 3.3
Hardware: Disk Drive, Paddles,
Sensors (switches)
Description: Apple Alarm is a program
that converts your computer into a
sentry, keeping track of fire, smoke,
intrusion, motion, moisture and other
on/ off sensory inputs. Attach your
floor mat, door-window switch, fire
alarm or other sensor to the paddle but-
tons and your Apple will sound an
alarm or quietly keep time from the
moment triggered. Have yom Apple
guard your home, tell you when the
kids came home... or left. Know when
your night janitor arrived.
Copies: Just released
Price: $20.00 includes 12-page
manual
Author: Andent Inc.
Available: Andent Inc.
1000 North Ave.
Waukegan, Illinois 60085
Name: COMCON Disk
System: OSI Challenger (C2 and
C3 series)
Memory: 32K or 48K
Language: BASIC/6502 Assembly
under OS65D
Hardware: Disk drive, modem,
CRT, optional printer;
(video and serial versions
available).
Description: A telecommunications
interface program providing smart ter-
minal facilities via modem. Useful for
transferring software or data files and
saving them on disks. Allows com-
munication with mainframes or other
micros, uploading and downloading
and printing. Control key initiation of
LOGON messages. User-controlled
tailoring of protocol and system
characteristics, including port and out-
put device, half or full duplex, parity,
checksums, baud rate, and line control.
Price: $45.00 on 8" disk
postpaid. Includes
documentation (specify
32K or 48K version, and
whether serial or video] .
Author: Sid Brovmstein
Available: Responsive Computer
Technology, Inc.
P.O. Box 719
Silver Spring, Maryland
20901
Name: Laser Wars
System: OSI CLP or Superboard
Memory: 8K
Description: Maneuver your space craft
to line enemy fighters in your cross-
hairs and destroy them with your
lasers. A fast action arcade-type game
with machine language graphics for one
player.
Price: $7.95 ppd.
Author: Brian and Craig Zupke
Available: BC Software
9425 Victoria Drive
Upper Marlboro,
Maryland 20870
Name: Perception 3.0
System: Apple n or Apple n Plus
Memory: 48K
Language: Applesoft
Hardware: Apple n, Disk Drive, M
Game Paddles "
Description: Seven High-Resolution
activities will challenge the user's
visual perception and hand-eye coor-
dination. Activities are Length Percep-
tion; Shape Memory; Size Comparison;
Star Trace; Centering a Falling Line;
Visual Pmrsuit; and Tilt Maze. Each of
the activities offers a wide range of
parameter settings for both the skilled
and unskilled user.
Price: $24.95 includes
documentation and
diskette.
Available: All computer dealers, or
Edu-Ware Services, Inc.
22222 Sherman Way,
Suite 102
Canoga Park, California
91303
Name:
A-2a. Moving Averages
System:
PET
Memory:
8K
Language:
BASIC
Hardware:
PET/CBM
Description: Computes centered mov-
ing averages for 3 span lengths and
prints values and/ or differences.
Discloses cyclic movements in a time ,
series such as stock prices. Includes '
logical file input and modification to
update and delete old data.
Price: $15.00 for cassette and
documentation
Author: Claud E. Cleeton
Available: Claud E. Cleeton
122-109th Ave., S.E.
Bellevue, Washington
98004
Name:
AIM Video-Ttek
System:
AIM 65
Memory:
12K
Language:
BASIC
Hardware:
Video terminal
Description: A new Trek game designed
to run on any AIM 65 with 12K
memory and a video terminal. You
command the Enterprise in its search
to destroy the invading Klingons. You
have superior weaponry, but they have
a cloaking device. Sotmd effects are
provided by using CB2 output of the
User 6522 VIA (CB2 sound instructions
included).
Copies: Just released
Price: $12.00 on cassette, ppd.
Author: J.S. Wahlquist
Available: J.S. Wahlquist
1643 N. Formosa Ave., #4
Los Angeles, California
90046
102
MICRO - The 6502/6809 Journal
No. 38 -July 1981
JMCRO
^ Microbes
and Updates
Mike Rowe
Microbes & Updates
P.O. Box 6502
Clieimsford, MA 01824
f.G. Wendel, of Ann Aiboi,
Michigan, sent this miciobe:
For some tiiae I've been using Mr.
B.E. Baxter's fine routine in the January
1980 MICRO (20:30] for direct writing
to the Apple screen. Just now I've
discovered a small bug in it, because I
happened to fill up line #16, apparently
for the first time. What happened was
that the last character of the line was
lost, because the file should be saved
with length $3DD rather than $3CF. The
correction consLsts in changing the code
at $0396/7 in your program to C4 BO.
•
Edward H. Carlson, Okemo, Michi-
gan, sent us this update to bis article:
I have received some phone calls
about my article, "A 6502 Assembler in
BASIC," in MICRO (34:7). If you are
having trouble making the program run,
rest assured that it does work on OSI C2
and C4 machines, as is. Dale Mayers
pounded it into his C4P and found no
real errors. However, he did point out
that the 56 in line 124 should really be a
14. He also pointed out that a cleaner
logic is possible in this region and the
program will then nm slightly faster and
use less memory. The changes are:
124 FOR 1 = 1 T0 4:F0R J = 1
TO 56 STEP 4
130 IFL$ = MID$(C$(I),J,3)
THEN N = 14*(l-1) + {J + 3)/4:
GOTO 161
155 delete
163 0P=:VAL(MID$(F$(I),J,3))
If you are having trouble, you have
made a key- in error. Check out the pro-
gram using PRINTS, and check every
possible op code and addressing com-
bination. A lot of work? You bet, but
worth it! Finally, if you have a CI, you
will need to change the screen display to
fit it into 24 characters, probably using
PRINTS rather than POKEs. It would be
much appreciated by readers of MICRO
if anyone who makes the conversion of
this program to a CI or other machine
will write a letter describing the
modifications.
John G. Ruff of Plymouth, Minne-
sota sent us the following update:
I read with great interest the March
1981 article, "A 6502 Assembler in
BASIC," by E. H. Carlson (34:7). After
only a short time I began the translation
into my 24K OSI CIP with 64 x 32
video. During the process I discovered
items worth commenting on. "
1. Although spaces on lines are con-
venient for casual reading (especially
when used to an editor/ compiler), a
user with 4K RAM caimot afford the lux-
ury; there are 104 spaces (bytes) in lines
2000 - 2027! By removing all spaces and
REMark statements there will be about
two pages available above BASIC. Line
2030 should be changed to point to the
beginning Non-BASIC location to pre-
vent overwriting the BASIC vectors in
page 2. After removing all spaces (lines
2000 - 2027), change the following lines:
124 FORI = 1T04:FORJ = 1T014:
N = 3*J-2
163 0P = VAL(MID$(F$(II),
JJ*3-2,3))
Be sure to run the program (without do-
ing any assembly) before attempting to
determine the highest location used by
BASIC, since variable and string space is
allocated at RUN time.
2. The following addressing modes
are not documented by the author,
although they are included in the
program:
a. Indirect:
JMP( )
b. Indexed Indirect:
ADC(**;X)
c. Indirect Indexed:
ADC(**);Y
Note: * * equals Hex digit.
3. To allow the conversion of hex-
adecimal numbers with 1,2, 3 or 4 digits
change lines 4000 - 4050 to the following:
4000 N = 0:LL=16:FORI = 1TOL
4010 M=ASqMID$(C$,l,1))
-48:M = M + 7*(M 9)
4020 N = N-l-M*(LL (L-l)):
NEXT:C$ = STR$(N):N = 0-1-23
-(LEN(C$))
The above wUl also right-justify the
decimal output to allow alignment with
the ASCn output.
I have used the above assembler to
buUd several small device handlers and
find the program most successful.
Should there be any questions feel free
to contact me at Weldon Electronics,
Inc., 14010 23rd Ave. No., Plymouth,
MN 55441 (612/559-1984).
Lee Meadoz of Arlington,
wrote to us with this tip:
Texas
The article entitled "Create a Data
Disk for DOS 3.2 and 3.2.1" m the June
81 issue is indeed interesting for some-
one who needs to save space for data on
Apple n disks. There is one related item
that needs to be made known about the
use of track 0. The Apple DOS [3.2 or
3.3) does not allow the use of track zero.
Consider how the track/ sector list is
used by the DOS. [See pages 128-129 of
the DOS manual.) In the list two bytes
hold the track (1 byte) and the sector (1
byte) of the appropriate sector of the file.
The first item in the list for the first 256
bytes of the file, the second item for the
next 256 bytes, etc. If the first of the two
bytes i&zero, then it is assumed by DOS
that that block of 256 bytes is not used
in the file. A sector is not allocated for
that group of 256 bytes. Perhaps this is a
design error in the DOS, or perhaps they
thought no one would ever try to use
track so they could cut out a few bytes
of code to speed things up a little. (Ob-
viously, only track 0, sector should be
off limits.) Anyway, when that first byte
is zero, the DOS, rather than looking on
track zero for the sector, will assume
that the sector doesn't exist.
This isn't a problem if all your files
are created and read by DOS. DOS will
never allocate a sector on track zero,
whether you free up the space or not.
But... some file copy programs, in par-
ticular, FID, MUFFIN and its
derivatives, DEMUFFIN, and Niffum,
and other s imil ar programs, will put
parts of files into track 0. The problem is
only noticed afterwards when you try to
use DOS to access the file. It isn't there.
I suggest this change to Mr. Sogge's
article to solve the problem. Change the
line three up from the bottom of the
middle column of page 49 from
"(11,0,38) to FF EO 00 00" to read
"(11,0,38) to 00 00 00 00". This will
leave track marked as in use and the
file copy programs won't be tempted to
allocate space there.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
103
Hot pursuit
through space
and the
vortices
of time!
PRESENTS. . .
Sintc toffd
The fallen Time Lord, who presumptuously calls himself The Master, is at large.
The elders of Waldrom have supplied you with the hyperspace-worthy vessel
Tardus, and commissioned you to eliminate the evil "Master". Your resources
include clones who will fight for you, the formidable CRASER weapons of the Tardus,
and magic weapons such as Fusion Grenades and Borelian Matrix Crystals.
Traveling through hyperspace in search of the evil one, you will encounter Time
Eaters, Neutron Storms, and other alien creatures and phenomena. Entering real
space to search planets, you will encounter still other dangers. You will enter native
settlements to buy food and supplies — or to fight for survival.
And once you find The Master can you destroy him?
Based on Dr. Who of PBS fame.
■ Apple Integer Basic,
!7-.-.-.-.-.-.\ Disk, 48K . . . $29.95
15€:l-iPlR0SID€
6 South St.Milford. NH 03055 (603)673-5144
TOLL FREE OUT-OF-STATE 1-S00-258-1790
104
MICRO - The 6502/6809 Journal
No. 38 -July 1981
#
BAS/C
fCfHOffcomjm
Amfffcmam
TSEHARDSIDE HAS IT ALL
IN ONE!
How many times have you wished that there was a single source for "^
your personal computer needs? Well look no further, TSE-
HARDSIDE, located in pleasant New Hampshire, has virtually every
conceivable item for your micro. Whether you're shopping for your
Apple, Pet, TRS-80™ or Atari, TSE-HARDSIDE has it all. We stock
hardware, software, books, magazines and specialty items for ail of
the popular machines. So the next time you're out shopping for your
system don't be surprised, be satisfied. Remember tlie name TSE-
HARDSIDE as your choice for quality, service and reliability.
TSeiHPIRDSIfX
6 South St .Millord. NH 03055 (603)673-5144
TOLL FREE OUT-OF-STATE 1-800-258-1790
MICRO - The 6502/6809 Journal
105
IMCQO
Dr. William R. Dial
438 Roslyn Avenue
Akron, Ohio 44320
6502 Bibliography: PartXXXVlii
(
985. Abacus n 2, Issue 11/12 (November/December/l980)
Anon., "lAC Apnote: Serial Handshake Modification
with Tabs," pg. 4-5.
Using the Apple High Speed Serial Interface Card with
printers and using the existing data input line to sense if
the printer is busy.
Anon., "lAC Apnote: Upper/Lower Case and Special
Characters," pg. 9-15.
A method for using the language card on the Apple so
that control of upper and lower case is controlled by the
shift key.
Sokal, Dan, "lAC Apnotes: Pascal PEEKs and POKEs,"
pg. 13-15.
A program for your Pascal library.
Anon., "lAC Apnote; Text Screen Mapping and Use,"
pg. 16-17.
Ml about text pages, screen maps, and character display
values, including an example of use.
Davis, James P., "Savings," pg. 23-24.
A program to calculate interest on savings with your
Apple.
Davis, James P., "Printer On — Says-a-Me," pg. 24.
A printer control program for the Apple/Trencom
200/AII-g combination.
Davis, James P., "Print Catalogs," pg. 25.
i\n easy to use catalog printing routine for the Apple.
Robbins, Greg, "DOS Tricks for DOS 3.2.1/' pg. 26.
Several techniques for users of Apple DOS 3.2.1.
Anon., "How to Obtain Those Special Characters,"
pg. 27.
A machine language routine that allows several extra
characters to be printed on the Apple n.
Davis, James P., "Two M/L Sound Effects Programs
Revisited," pg. 29-31.
Tutorial with two example routines for the Apple.
986. Peek(65) 1, No. 12 (Decembei, 1980)
Stevenson, Greg, "U2," pg. 2-5.
Tips for OSI users including an addition to BEXEC to
add flags.
McMurray, C. Eugene, "Something for Nothing,"
pg 5, 16.
How to avoid confusion between variables and BASIC
iimction labels on OSI micros.
Jones, Davis A., "Cassette Comer," pg. 6.
Some hardware and software assists for cassette
operation.
Hooper, Phil, "CALL for OSI BASIC," pg. 7-8.
How to provide a CALL routine for the OSI machines to
invoke a machine language program.
Williams, Jim, "How to Edit Programs and Keep
Variables," pg. 8.
Tips on the use of OSI BASIC variables.
Anon., "Location of Routines," pg. 10-11.
A listing of location of routines in Microsoft BASIC
Ver. 1.0, Rev. 3.2 in OSI CIP and Superboard H.
Lundberg, Charles " 'PRINT AT' Hides in BASIC,"
pg. 11.
A formatting technique for OSI users.
Goodman, Kelsey, "OSI Files," pg. 14-15.
Discussion on handling OSI files.
Dermis, Neil, "Graphics Program," pg. 16.
A graphics program to draw patterns on the OSI screen.
987. Stems from Apple 3, No. 12 {December, 1980
Stein, Dick, "Review of Pascal Version 1.1," pg. 4, 9, 13
Version 1.1 of Apple Pascal has had many changes,
reviewed in this article.
Anon., "Renumber Problem — DOS 3.2 and 3.3," pg. 8.
How to fix a bug in the Applesoft Renumber program.
Robinson, Alan H., "A Look at Fortran," pg. 10-12.
Comments on a user's experience with Apple Fortran.
Some pitfalls to be avoided are discussed.
Dulk, G.A., "Use of Apple as a Word Processor,"
pg. 15-19.
The Apple Pascal system has many of the desirable
features of a Word Processor.
Warren, John W., "Ballistic," pg. 20-22.
This program will calculate and print a complete
ballistics table, bullet flight path, etc.
988. The Apple Peel 2, No. 12 (Decembei, 1980)
Brown, Tom, "POKE Salad," pg. 4-5.
Discussion of a malfunction of the VAL function which
is memory dependent, for the Apple.
Graham, Johimy, "13/16 Sector Switch Modification,"
pg. 6.
Add a switch to yoxir Apple disk controller card to
switch from 13 to 16 sectors (DOS 3.2/3.3|.
Donahue, Tom, "13/16 Sector Switch," pg. 7.
Another approach to switch between 13 and 16 sectors
on the Apple disk system.
989. MICRO No. 31 (December, 1980)
Carlson, Ron, "Graphing Rational Functions,"
pg. 7-9.
A discussion and listing of a general-purpose graphing
program for the Apple hi-resolution screen.
Elm, Robert L., "A CIP User's Notebook," pg. 11-13.
Secrets of the Challenger and notes on ACIA, graphics,
tape control, etc. for OSI users.
Davis, Harvey S., "Drawing a Line on PET's 80 x 50
Grid," pg. 15-19.
A collection of flexible machine language routines for
graphing.
Weiner, Eugene V., "A Random-Character Morse Code
Teacher for the AIM 65," pg. 21-23.
Program your AIM to generate code soimds at 13 words
per minute and up.
Tibbetts, Gregory L., "An Apple Flavored Lifesaver,"
pg. 25-30.
An Apple game.
106
MICRO - The 6502/6809 Journal
No. 38 -July 1981
9'
•
Wright, Loren, "MICRO PET Vet," pg. 33.
Several new Commodore products are discussed.
McBumey, N.R., "Creating an Applesoft BASIC Sub-
routine Library," pg. 37-40.
Using EXEC instead of RUN offers increased flexibility
and can link Applesoft programs from a common disk-
resident library.
Staff, "Microscope," pg. 43.
PBASIC-DS Version Two is reviewed.
Crites, Roger C, "Stuffit," pg. 45-47.
A time-saving utility program for PET BASIC files.
Rowe, Mike (Staff), "New Publications," pg. 51.
Two new books are reviewed.
Froelich, Jerry W., M.D., "Microprocessors in Medicine:
The 6502," pg. 53.
Discussion of 6502 computer programs in medical
education.
Lindsay, Len, "Atari Bits," pg. 57-59.
Discussion of Atari keyboard buffer, screen protect
feature, dynamic keyboard, hi-resolution graphics, etc.
Taylor, William L., "Relocating OSI ROM BASIC Pro-
grams," pg. 61-63.
This BASIC program will assist OSI users to understand
how their Microsoft BASIC and monitor are used.
Vrtis, Nicholas J., "Cassette I/O for SYM BASIC,"
pg. 65-69.
Expand the capabilities of SYM BASIC with this
cassette I/O handler, allowing access of the cassette as
a data file.
Boering, Brooke W., "Multiplying on the 6502,"
pg. 71-74.
Here are five routines to speed up multiplication on any
6502 system.
Dial, Wm. R., "6502 Bibliography: Part XXVn,"
pg. 89-93.
Over 150 new references to the voluminous and grow-
ing 6502 literature.
990. The Apple-Dillo (December, 1980)
Teas, George, "Pascal Primer," pg. 5.
Pascal routines providing ready access to inverse and
flash functions on the Apple.
Beal, Bob, "Using Parameters with the Control- Y
Monitor Command," pg. 6-8.
A discussion of the Apple Control-Y with two listings
as demos.
991. The Seed 2, No. 12 (December, 1980)
Nelson, Rod, "Apple Speed," pg. 7.
An interesting experiment comparing the speeds of
routines.
Anon., "lAC APNOTE: The Apple n Cassette Interface,"
pg. 20-23.
A good discussion of the operation of the cassette inter-
face on the Apple n.
992. O.S.I. Users Independent Newsletter No. 7
(December, 1980)
Curley, Charles, "OSI Resources," pg. 1-13.
Entire issue devoted to a catalog of OSI resources in-
cluding hardware, utilities, education and business pro-
grams, word processors, etc.
993. Southeastern Software Newsletter No. 23 (December,
1980)
McClelland, George, "Update on Word Processing,"
pg. 4-5.
Discussion of Super Text n and 80-character Apple Pie
and format.
Christman, John, "Printer Controls for the Paper Tiger,"
pg. 8-9.
This Applesoft program prints out the number of col-
umns for each size of print on the Paper Tiger.
Sander-Cederlof, Bob, "Character Codes," pg. 9.
A short routine to print out a chart of the complete
Apple screen codes.
Powell, David, "Apple Escher," pg. 9.
A graphics program for the Apple Hi-Res screen.
994. From the Core (December, 1980)
Budge, Joe, "Natterings from the Nabob," pg. 3.
A fix for the renumber program in DOS 3.3, disk center-
ing problems, a mod for Apple disk analog cards to
reduce errors in going from disk to disk and 3.2 to 3.3,
how to identify disk drives made by Shugart and an
alternate supplier.
Anon., "Copyone," pg. 4.
An improved Pascal single disk copy.
Anon., "Oligopoly Simulation," pg. 8-9.
A program to model a simplified economic system and
determine the most profitable pricing strategy given a
number of alternatives.
995. The Cidei Press (December, 1980)
Weiglin, Peter C, "Formatting — Part Three."
More on formatting techniques for the Apple.
Roxburgh, Alastair, "Tape to Tape Copy," pg. 6.
How to copy difficult programs on the Apple cassette
interface.
Fields, Randy, "Extensions to Print Using," pg. 7.
Additional information on the Print Using function.
Thompson, C.J., "Niffum," pg. 8-9.
A reverse MUFFIN (DOS 3.3 to 3.2 converter) for the
Apple.
Anon., "Try These Patches on DOS 3.2: Part n," pg. 9.
A second installment of some handy DOS modifica-
tions for the Apple.
Schaffer, Jay, "FRE(x) Modifications," pg. 10-12.
A sixteen-sector version of a program to find the free
space remaining on a diskette.
Nareff, Max J., "Beginner's Notes on Pascal," pg. 15-16.
A program in Pascal demonstrating the use of the ' ' String' '
intrinsic functions (COPY, POS, CONCAT). Also a
split-screen demo.
996. Washington Apple Pi 2, No. 12 (December, 1980)
Anon., "The Case of the Disappearing Directory,"
pg. 7-11.
Discussion of the Pascal handling of directories.
Wurzel, Bill, "Linear Scaling in Hi-Res Graphics,"
pg. 17-18.
A tutorial in Apple Hi-Res graphics.
Wurzel, Bill, "A Bug in the Toolkit Assembler," pg. 18.
A bug in the 6502 assembler on the Toolkit disk and a
fix for the bug.
Schwartz, Dana J., "Dana's Hex Loader," pg. 18-20.
A utility for the Apple.
Crosby, Mark L., "Questions, Questions, Questions,"
pg. 21.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
107
Some common questions on Apple programming or
operation.
Mitchell, Howie, "Printing Out the Hi-Res Screen,"
pg. 22-24.
A program for the Apple and the Anadex DP-9501
printer.
Cottrell, C, "Equations for Some Common Bessel
Graphs," pg. 24-27.
Equations and listing to print Bessel function graphs.
997. AppleGram 2, Issue 12 (December, 1980)
Sander-Cederlof, Bob, "Word-Search Puzzle Maker,"
pg. 3-7.
Routines to develop matrices of letters and to find
hidden words therein, for the Apple.
Firth, Mark, "Short Cut to Common Routines," pg. 8.
How to get a common routine into several programs
using the Renumber program and the EXEC function on
the Apple.
Firth, Mike, "MID$ vs. LEFTS and RIGHTS and Other
Routines," pg. 13-14.
A series of handy routines and techniques for the Apple.
998. SoftSide 3, No. 3 (December, 1980)
Pence, Fred, "Christmas Card," pg. 20-21, 50-51.
An Apple program using Lo-Res graphics.
Pelczarski, Mark, "The Developing Data Base,"
pg. 30-33.
Part 4 of a continuing series for the Apple and Atari.
Barts, Duane, " Connect- A-Dot," pg. 34-37.
A sketching program for the Apple Hi-Res graphics.
Ward, Dermis and Osbome, Leon A., "One-Liners,"
pg. 51.
Several programs for the Apple.
Bohlke, Dave, "Baseball," pg. 65-68.
A game for the Apple.
McKenna, Michael, "Space Dodge," pg. 70-71.
A game for the Atari.
Bohlke, David, "States and Capitals," pg. 80-81.
An educational game for the Atari.
Bohlke, Dave, "Speedello," pg. 88-89.
An Othello-like game for the Atari.
999. G.R.A.P.E. 1, No. 11 (December, 1980)
Wasson, Philip, "Fast Hi-Res Scroll," pg. 4.
An Apple program for a machine language fast scroll.
1000. Softalk 1 (December, 1980}
Wagner, Roger, "Assembly Lines," pg. 14-16, 22.
Part 3 of a continuing tutorial on Assembly language,
for the Apple.
1001. Apple Assembly Line 1, Issue 3 (December, 1980)
Laumer, Mike, "Integer BASIC Pretty Lister,"
pg. 3-8.
An Apple program to make pretty listings of Integer
BASIC programs.
Sander-Cederlof, Bob, "S-C Assembler n Notes,"
pg. 9-14.
Discussion and patch for .da directive; block move and
copy for Version 4.0; etc.
Sander-Cederlof, Bob, "Handling 16-Bit Comparisons,"
pg. 16.
How to compare two double-by,re numbers on the
Apple for branching routines.
1002. T.A.R.T. 1, No. 1 (March, 1980)
Koerin, Sidney, "Ditty," pg. 2. .
A fix to DOS 3.2.1 of the Apple to make the LNIT pro- {
gram go faster.
Shanes, John, "Faster Than a Speeding Bullet!!", pg. 8.
Speed up your Apple cvirsor with this hardware mod.
1003. T.A.R.T. 1, No. 2 (May, 1980)
Rivers, Jerry, "Lower Case from Your Apple," pg. 2.
Two routines to allow you to use both upper and lower
case in your Apple programs.
1004. T.A.R.T. 1, No. 3 (October, 1980)
Anon., "Disk Labeling," pg. 3-4.
A BASIC program to label your Apple diskettes.
1005. T.A.R.T. 1, No. 4 (December, 1980)
Hubbard, Bill, "A Striking Article," pg. 2-3.
Add a typewriter-like sound to your Apple keys.
1006. Apple Bits 2, No. 10 (December, 1980)
Anon., "Apple Disk n Card DOS 3.2/3.3 Switch
Modification," pg. 4.
A convenient hardware mod for the Apple disk con-
troller card.
Koehler, John, "BASIC Basics," pg. 5.
A common denominator program for the Apple.
Kovalik, Dan, "Taking the Mystery and Magic Out of
Machine Language," pg. 8-10.
An Apple Hi-Res graphs left/right flip program.
I
1007. The Apple-Dillo (January, 1981)
Clardy, Robert C, "Converting Integer BASIC Programs
to Applesoft," pg. 5-6.
A useful utility for the Apple programmer.
1008. OSIO Newsletter 3, No, 1 (January, 1981.)
Sand, Paul A. and Morganstein, David, "Pretty listing,"
pg. 1, 2-
Improve the appearance of your 6502 program listing
with this routine. For OSI computers.
Kiishner, Joe, "OS-65 Notes," pg. 3-5.
Some discussion of the handling of fUes on the OSI
system.
Compton, Radford, "Assignment: Format," pg. 6-7.
Format a report with this OSI program.
1009. The Harvest 2, No. 5 (January, 1981)
Stadfeld, Paul, "Toccata and Fugue in CTRL-D,"
pg. 1-3.
A tutorial on Apple keyboard logic, modifications to the
keyboard, etc.
1010. The Apple Peel 3, No. 1 [January, 1981)
Jenkins, Jerry, "Space Saver," pg. 6.
Get more storage area on that diskette for your Apple
Hi-Res pictures.
Jenkins, Jerry, "APTYPE/MX-80," pg. 6.
Improve the compatibility of the APTYPE/MX-80 com- i
bination on the Apple.
108
MICRO - The 6502/6809 Journal
No. 38 -July 1981
'9
m
m
1011. The Seed 3, No. 1 (January, 1981)
White, Hairy, "Move On, String Writer," pg. 3-4.
A tutorial for Hi-Res graphics on the Apple, with a Hi-
Res page move demo.
Anon., "Apple Pi Conventions," pg. 6.
A utility to set up program REM statements, etc.
1012. Nibble No. 8 (January, 1981)
Capella, Mark, "Will 'O The Wisp," pg. 9-21.
A fantasy game for the Apple.
Riley, Kevin D., "Cassette Tape Visual Display
Monitor," pg. 22-23.
A mod to make tape loading more reliable.
Laird, Alexander, "Fun with Apple's Assembler," pg. 27.
Some insight into the Apple Monitor's graphics.
Dan, Robert W., "Apple and the 3.3 DOS," pg. 31.
A review of the new DOS and it's feature utilities.
Berman, Andrew, "Blast Away!", pg. 35-39.
A shooting gallery program for the Apple.
Harrell, Keith, "Pascal Pointers and Principles,"
pg. 41-45.
The filer of the Pascal system and the compound
statements.
Reynolds, William m, ' 'String Function for Integer BASIC
Programs, pg. 53.
A subroutine allowing for a string variable to be set
equal to the printed string of a numeric variable on
the Apple.
Szetela, David P., "BASIC/Machine Language
Subroutine Creator," pg. 53.
A BASIC POKE creator for the Apple BASIC.
Reynolds, William m, "Deleting Files Absolutely,"
pg. 53-57.
Defeat the recovery of a deleted file on the Apple
diskette.
Thompson, C.J., "Niffum," pg. 61.
A reverse muffin for the Apple DOS 3.3/3.2 systems.
Abrams, Larry, "Loan Reduction Analysis/Display,"
pg. 63.
A financial program for the Apple.
1013. KB Microcomputing No. 49 (January, 1981)
Baker, Robert W., "Potpourri: New PET Monitor,"
pg. 10-13.
A well-documented monitor ROM called Mojana/1,
BASIC 4.0/DOS 2.1, etc.
Baker, Robert, "Real-Time Spectrum Analyzer,"
pg. 48-50.
A PET program for audio signal analysis.
Chamberlin, Hal, "Simulation of Musical Instruments,"
pg. 53-58.
Computer music synthesis for 6502 machines.
Rager, Edward, "Scramble," pg. 78-80.
A PET program demonstrating the utility of nested
subroutines.
Deininger, Rolf A. and Tujaka, Don, "Apple Coimec-
tions," pg. 122-123.
Put connectors on the back panel of your Apple for
convenience in connecting peripherals.
Hirbemik, Robert M., "Space Race," pg. 126-128.
A graphics game for the Apple.
Baker, Donn Burke, "Reverse Video for the OSI CIP,"
pg. 176-182.
A $10 hardware mod for the CIP.
Hutchinson, Thomas E., "Second Cassette Interface with
OnelC'pg. 188-190.
Improve the flexibility of your PET with this mod.
1014. Byte 6, No. 1 (January, 1981)
Crawford, Chris and Winner, Lane, ' 'An Introduction to
Atari Graphics," pg. 18-32.
A tutorial on Atari graphics with two listings.
Roybal, Phil, "The Picture-Perfect Apple," pg. 226-235.
An Apple program in Assembly language for the
Qume Sprint Micro 3 printer.
1015. Softalk 1, No. 5 (January, 1981)
Wagner, Roger, "Assembly Lines, Part 4," pg. 22-27.
Incrementing, decrementing and loops in assembly
language for the Apple.
1016. Atari Computer Enthusiasts 2, Issue 1 (January, 1981)
De Groot, Bill, "Business Program," pg. 2.
An Atari program to calculate interest and payments
on loans.
1017. Interface Age 6, No. 1 (January, 1981)
Baker, Al, "Game Comer," pg. 22-26.
A game for the Atari called "Cannon Duel."
Zant, R.F., "File Cabinet and Ampersosrt n," pg. 94-96.
Improve the sort routine in the Apple File Cabinet.
1018. The G.R.A.P.E. Vine (January, 1981)
Ude, Art, "Neon Sign," pg. 3.
A program of the crawler or banner type for the Apple.
Ude, Art, "Throttle," pg. 4.
Applesoft and Integer BASIC listings for slow list on the
Apple.
Lawson, Steve, "Screen Position," pg. 5.
An Apple program to find the screen position given row
and column parameters.
Lawson, Steve, "Binary to Decimal to Binary Conver-
sion," pg. 6-7.
An assist to converting numbers on the Apple.
1019. From The Core (January, 1981)
Budge, Joe, "King Kluge," pg. 3.
A hardware mod for the Apple to restore singlestep and
other Old ROM features on your Autostart machine.
Whittaker, Alec, "Timer Subroutine," pg. 5.
An inexpensive clock for the Apple.
Holzworth, Paul, ' 'The Secrets in Your Apple, . . .Maybe, ' '
pg. 7.
An examination of the latest Apple motherboard seems
to predict things to come.
Budge, Joe, "UPPER/lower Case Pascal," pg. 8.
Modify your Apple BIOS to allow U/L in Pascal.
Anon., "DOS to Pascal Transfer Program," pg. 8-9.
A program which will transfer Apple files from DOS to
Pascal.
Anon., "L/C System Startup for Pascal 1.1," pg .13.
A program which calls an assembly language routine to
set up various startup options of the Apple.
1020. The Michigan Apple-Gram (August, 1980)
Rivers, Jerry, "Technical Tidbits," pg. 6.
Fix for the fix for the DOS Append on 3.2 and 3.2. 1; gar-
bage collection to free up space, etc. for the Apple.
No. 38 -July 1981
MICRO - The 6502/6809 Journal
109
Anon., "lAC Apnote: Applesoft Array Eraser," pg. 16.
A program for the Apple.
Anon., "lAC Apnote: Converting Integer BASIC Programs
to Applesoft," pg. 19.
A discussion of a useful procedure for the Apple.
Anon., "lAC Apnote: Out of Memory Errors," pg. 20.
Reasons for getting "Out of Memory" errors on the Apple.
Anon., "lAC Apnote: VTAB and HOME Converter,"
pg. 21.
Some useful routines for the M&R SUP-R-Terminal on
the Apple.
Anon., "lAC Apnote: Modifying the LISA Assembler,"
pg. 22.
Modification of the Apple utiHty to handle user functions.
Anon., "lAC Apnote: DEL Character Killer," pg. 26.
A routine for the Apple system.
Anon., "lAC Apnotes: Misc. Apnotes for Apple Pascal
Systems," pg. 28-37.
A series of Pascal Notes on GETREM, TAKE 280,
TRANSFER, FOREIGN, LONG INTEGER FIX,
LOAD/SAVE to DISK, etc.
1021. The Michigan Apple-Giam (Septembei, 1980)
Tuttleman, Roger, "Disk Inform," pg. 7-10.
An Apple assembly language program for printing infor-
mation about a diskette.
Rivers, Jerry, "Technical Tidbits," pg. 11-14.
A tutorial on the 6502 operation and the LISA
Assembler.
Hall, Lennis L. and Ankofski, Tom, "Select By Number,"
pg. 17-19.
A Hello program for the Apple Disk system.
1022. The Michigan Apple-Giam (October, 1980)
Neuhauser, Robert, "I/O Port and Joysticks," pg. 5.
A hardware article for improving the game port I/O of
the Apple.
Holderby, Michael, "Integer BASIC Token Scheme,"
pg. e-1.
A tutorial for the Apple.
McClaren, Mac, "Catalog Free Sectors Revisited," pg. 7.
A listing that works in either Applesoft or Integer
BASIC, together with notes on just iow this machine
language routine works.
Smith, Paul, "Catalog List," pg. 8-9.
A tutorial for the Apple.
Tuttleman, Roger, "Integer BASIC Append Methods,"
pg. 11-12.
Several routines for the Apple, including 'To Text
Create,' a program to create an EXEC file to convert
BASIC programs to Text files.
Tuttleman, Roger, "Fix for Applewirter," pg. 12.
A fix for using Applewriter with the Paymar Lower Case
Adapter.
Tuttleman, Roger, "Integer Info Create," pg. 13.
A program to create an EXEC file to return HIMEM,
LOMEM, start of program and end of variable address.
Anon., "My Disk Ruimeth Over," pg. 15-16.
Several routines including one that allows the Apple to
use graphics programs written for the TRS-80, a fast
text-copy program, etc.
1023. The Michigan Apple-Giam (November, 1980)
Holderby, Mike, "Programmer's Comer," pg. 5.
A tutorial on how to add beeps, buzzes, etc. to your
Apple programs.
Walker, Carl, "DOS Patch for Single Stroke Entry,"
pg. 6.
A Single Stroke Entry to use with DOS.
Tuttleman, Roger, "Remove Lisa," pg. 8.
A utility for Apple users of the LISA assembler. .
Rivers, Jerry, "Text File Reader," pg. 9. \
A program to read any sequential text file into memory.
McLaren, Mac, "Disk Zap Conversion with DOS 3.3,"
Pg-9.
Mods for the popular Disk Zap utility to adapt it to the
new Apple DOS 3.3.
Tuttleman, Roger, "Introductory Fortran Program,"
pg. 10-11.
A short program showing the forms of various FOR-
TRAN statements and how to get the Apple clear of the
bugs.
Smith, Paul and Rivers, Jerry, "Serial Interface Card Tab-
bing," pg. 11.
How to tab past column 40 using the Apple serial inter-
face card.
Tuttleman, Roger, "FORTRAN Turtle Graphics Demo,"
pg. 14-15.
A simple Apple program demonstration of Fortran Tur-
tle Graphics.
Tuttleman, Roger, "POKE Writer," pg. 15.
A program to convert assembly language routines to
POKES for BASIC programs.
Macdowell, Mac, "My Disk Runneth Over," pg. 16-17.
A software mod for Apple sound, and a telephone dial-
ing routine that yields fast dialing capability.
Paul, L., "Un-Muffining Routine," pg. 17.
A procedure for converting a program from DOS 3.3 to
DOS 3.2.
Rivers, Jerry, "The FORTRAN Format," pg. 18-19.
Notes from an Apple Fortran user with a Fortran listing |
of TEXTPRT, a routine to print any 'Text' file to yom:
printer.
Tuttleman, Roger, "Free Sectors," pg. 20.
An Integer BASIC program to print the volume number
and number of free sectors on an Apple disk.
1024. The Michigan Apple-Gram (December, 1980/
January, 1981)
Holderby, Mike, "Programmer's Comer," pg. 6-7.
A look at Apple's error trapping and input editing
techniques.
Rivers, Jerry, "Fortran Format," pg. 7.
Notes by an Apple Fortran user shows the pitfalls in
this language.
Lea, Diane, "Beginner's Comer," pg. 10-11.
Some tips for new Apple owners, including a graphics
listing.
Tuttleman, Roger, "RWTS Disk I/O From BASIC,"
pg. 12-16.
A guide to using the RWTS disk utility, with several
programs and routines for the Apple.
Rivers, Jerry, "Maybe You Didn't Know That...,"
pg. 17-18.
Some interesting notes on the Apple HIMEM:,
LOMEM:, the speed of interpreters vs. compilers,
Pascal and Fortran speed, etc.
Wiggington, Randy, "Read/ Write Track-Sector,"
pg. 20-35.
Listing for this major Apple utility and a description of |
its internal workings.
110
MICRO - The 6502/6809 Journal
No. 38 -July 1981
'W
INTRODUCING
COGNIVOX Series VIO-1000
A Revolutlonaiy New
Voice Input and Output Periplieral
Higli Fidelily Voice Response
Industrial Quality Recognition
PET - AIN-65 - APPLE H
COGNIVOX series VIO-1000 is a top-of-the-line voice I/O
peripheral for business and educational applications and the
demanding hobbyist.
It can be trained to recognize words or short phrases drawn
from a vocabulary of 32 entries chosen by the user. It will talk
back with up to 32 words or short phrases. In disk based systems,
response vocabularies can be stored on the disk and brought to
memory as needed, giving an effectively unlimited number of
vocabulary entries. The quality of voice response is excellent,
and it is far superior to that of speech synthesizers.
COGNIVOX series 1000 comes complete and ready to plug
into your computer (the computer must have at least 16K of
RAM). It connects to the parallel I/O port of the PET, to the game
paddle connector on the Apple and to the J1 port on the AIM-65.
Connectors are included as required. Also included are a
microphone, cassette with software and extensive user manual.
A built-in speaker/amplifier is provided as well as a jack for
connecting an external speaker or amplifier.
Software supplied with COGNIVOX includes two voice
operated, talking video games, VOTH and VOICETRAP. These
games are absolutely captivating to play, and the only voice
operated talking games that are commercially available.
Adding voice I /O to your own programs is very simple. A single
statement in BASIC is all that is required to say or to recognize a
word. Complete instructions on how to do it are provided in the
manual.
In keeping with the VOICETEK tradition of high performance at
affordable price, we have priced COGNIVOX series 1 000 at the
unbelievably low, introductory price of $249 (plus $5 shipping in
the US, CA add 6% tax. Foreign orders welcome, add 1 0% for
handling and shipping via AIR MAIL). When ordering, please give
the make and model of your computer, the amount of RAM and
whether you have disks or not.
In addition to COGNIVOX senes VIO-1000, VOICETEK
manufactures a complete line of voice I/O pehpherals for most
of the popular personal computers. Speech recognition-only
peripherals are available for the 8K PET and the 4K AIM.
For more information call us at 805-685-1854 or write at the
address below.
Dealer Inquiries invited.
VOICETEK
Dept E , P.O. Box 388
Goleta, CA 93116
ADVERTISERS' INDEX
^"■iiiiiiii"" JULY 1981 ^^iiBii^ii^
Adveitiset's Name Page
Aardvaik Technical Services 74
Abacus Software 31, 60
Andromeda, Inc 2
Applied Analytics, Inc 17
Aurora Software Associates 69
Basic Business Solutions 94
Bruce Beech, Publisher 86
Beta Computer Devices 82
The Book 26
Broderbund Software 35
Central Point Software 82
Classified Ads 97
Computer Mail Order 98
The Computerist, Inc IBC
Cotmecticut Information Systems, Co 26
Consumer Computers 20
Continental Software 23
Creative Computing 112
Decision Systems 31
Digibyte Systems 12
Dr. Dobb's Journal 24
Fessenden Computer Service 31
Hayes Microcomputer Products, Inc BC
Human Engineered Software 90
Instant Software 58-59
Imprint Software 30
D.R. Jarvis Computing 36
Lazer Systems 4
LfK Enterprises 97
Logical Software, Inc 78
MICRO INK, Inc 57, 90, 93, 96
Microsoft Consumer Products IFC
MicroSoftware Systems 31
Micro-Ware Distributing Inc 44
Mittendorf Engineering 71
Nibble 100
Nikrom Technical Products 86
Ohio Scientific "Small Systems Journal" 92-93
Omega Software Systems, Inc 86
Orion Software Associates 78
Pegasys Systems 36
Perry Peripherals 60
Progressive Computing 80
Quality Software 40
Rainbow Computing '95
Recreational Computing 24
Rosen Grandon Associates 36
Sensible Software 32
Serendipity Systems, Inc 60
Skyles Electric Works 14
Small Business Computer Systems 36
Soft CTRL Systems 44
Southeastern Software 1
Technical Products 78
TSE-Hardside 104-105
Used Computer Exchange 60
Versa Computing 48
Voicetek Ill
Why Advertise in MICRO?
Find Out!
Call (617) 256-5515
Ask for Cathi Bland
No. 38 -July 1981
MICRO - The 6502/6809 Journal
111
fl seRsatioRal
>4pple II software
GPeative
softwape
Space Games-I
Cassette CS-4001 $11.95 4 programs Requires 16K Apple II or Apple II Plus
Saucer Invasion. Fire missies to destroy RocketPllot Maneuveryourspaceshipover
the invaders wtto fly at different speeds ttte mountain using tiorizontal and vertical
and altitudes. thrusters.
Star Ware. Shoot dovm as many TIE fighters Dynamic Bounoar. A colorful, nver-changing
as possible in 90 seconds. graphics demonstration.
Sports Games- 1
Cassette CS-4002 $11.95 4 programs Requires 16K Apple II or Apple M Plus
Baseball; A 2-player game with pitching, Breakout. Four skill levels and improved
batting, fielding, stealing and double scoring make this the best breakout ever,
plays.
Torpedo Alley. Sink as many warships as Darts. Use game paddles to control the
possible in 2 minutes. throw of 6 darts
Space & Sports Games Strategy & Brain Games
DiskCS-4501. $24.95
Requires 32K Apple II or Apple II Plus
Disk CS-4502. $24.95
Requires 32K Apple II or Apple II Plus
This disk contains all eight games from Thisdiskcontainsall12gamesandorograms
cassettes CS-4001 and CS-40C2. from cassettes CS-4003 and 08-4004.
Apple IS it^e registered trademark o< Apple CPntputsr I
Strategy Games
Cassette CS-4003 $11. 95 4 Programs Requires 16K Apple M or Apple II Plus
Blodiade. BuiW a wall to tiap your opponent, UFO. Use lasers, warheads or guns to des-
but don't hit anything. troy an enemy spacecraft.
Skunk. A 2-player strategy game played Genius. A fast-moving trivia quiz with scores
with dee, skill and luck. of questions
Brain Games
Cassette CS-4004 $11.95 7 programs Requires 16K Apple II or Apple II Plus
fl
^
■
■*!
2
3
C
H
B
D
n
^^"^
il_::£3U.SB
Dodgem. Be the first to move all your pieces Nuclear Reaction. A game of skill, fast
across the board in this intriguing strategy decisions and quick reversals of position
game.
^
H.»
Parrot. A Simon-type game with letters and Midpoints and Lines. Two colorful graphic
tones. Dueling digits is a version with num- demonstrations Tones lets you make mus
bers. and sound effects
Order Today
To order any of these software packages,
send payment plus $2.00 postage and
handling per order to Creative Computing,
Morris Plains. NJ 07950. Attn: Clarice
Visa. MasterCard and American Express
orders may be called in toll-free.
Order today at no risk If you are
completely satisfied, your money will
promptly and courteously refunded.
Creative Computing Software
Morris Plains, NJ 07950
Toll-free 800-631-8112
InNJ, 201-540-0445
creative computiR^ software
112
MICRO - The 6502/6809 Journal
No. 38 -July
You Can Do It All
with FLEXI PLUS^
Build a complete system or
expand your Apple or other
6502-based system.
6809-BASED MICROCOMPUTER
't^it^wA muatfaattiaBHap wi^a'nsHWJW''* ""^'^ pa'!g s^?aqB3B i5H3ijM»cgii&g''
FLOPPY DISK CONTROLLER
RS-232 COMMUNICATIONS
IEEE 488 BUS CONTROLLER
A remarkably flexible mic" '"~ ^'^rd
FLEXI PLUS is a 6809-based single boaro ir^crocomputer
with up to 56K of on-board memory, extensive serial and parallel I/O
capability and a cassette interface. It may be used witfiout the 6809 as an
expansion board for most 6502, 6800 and 6809 systems The Floppy Disk
Conllroller supports up to four 8" drives or three 5 V* " drives and provides IBM com-
patible formats. The fully buffered RS-232 Communications Port features programmable
data formats and baud rates from 50 to 19,200. The IEEE 48S Bus Controller supports inter-
facing to soph sticated instrumentation and test equipment.
MicrocomputBr Features:
• State-of-the-art Motorola 6809E
microprocessor
• Supports seven memory
devices; Up to 56K bytes
2K, 4K and 8K RAMs, EPROMs
or ROMs
• Cassette port handles many
formats
• 20 mA current loop TTY port
• 6522 VIA for parallel/serial I/O
• Directly expandable with VIDEO
PLUS and DRAM PLUS
Let us build your custom system.
Communlcailions Features:
• Programmable , baud rates
from 50 to 19.2K baud
• Parity generation and checking
• Programmable word length
and stop bits
• Full or half-dup!ex oooration
• F ill bu'ferini on all "nes
IEEE 488 Instrumentation Bus:
• Full implementation of IEEE
standard
• Uses Motorola 68488 confrol-
ter and 3448 buffers
• Standard 24-pin edge
connector
F!. »p« pon' , .:
• ND 791 supports IBM and
other formats
• Up to four 8" Shugart compati-
ble drives
• Up to three 5 !4" Shugart com-
patible drives
• Includes fundamental disk
operating software
FLEXI PLUS Base Price
Software Support:
• Includes a system monitor,
device drivers and other basic
software support
• We will be selling FLEXTm,
OS-9™ and/or other operating
systems that support BASIC,
Pascal, FORTH, word process-
ing, assemblers, and many
commercial software packages
Fl' ^"yr- : Controller Option
f f cri rocessor Option
RS-232 Coniniunications Option
IEEE 488 Bus Controller Option
TCB-108
TCX-931
TCX-932
TCX-933
TCX-934
$320
125
75
75
125
^?s]a
m
34 Chelmsford St., Chelmsford, MA 01824
6171256-3649
®
Add option prices to Base Price to obtain system price.
FLEXI PLUS must be ordered with at (east one option. Prices
quoted are for US only. Add $3.00 surface postage in US.
Please write for foreign pricing. Massachusetts residents
add 5 % sales tax,
OEM inquiries invited.
(FLEX is a trademark of Technical Systems Consultants)
(OS-9 is a trademark of Microware Systems Corporation)
TT^
And yet, it is perhaps the easiest-to-use
modem ever.
RS-232C Compatible. Smartmodem
lets any RS-232C compatible computer
or terminal communicate by phone with
other computers and lime-sharing sys-
tems located anywhere in North America.
You get full and half-duplex operation
with both Touch-Tone' and pulse dialing.
Auto-Answer/Oial /Repeat.
Smartmodem can answer the phone, dial
a number, receive and transmit data, and
then hang up the phone- automatically!
If desired, Smartmodem will even repeat
the last command. You can depend on
Smartmodem for completely unattended
operation.
Completely Programmable.
Smartmodem can be controlled using
icrocomputer Component Systen
any programming language. Over 30 dif-
ferent commands can be written into your
programs or entered directly from your
keyboard.
Smartmodem also includes sever-
al switch-selectable features that let you
tailor performance to your exact needs.
You can 'set it and forget if tor the ulti-
mate in convenience.
Built-in Audio Monitor. Thanks
to an internal speaker, you can actually
listen to your connection being made.
You'll know immediately if the line is busy
or if you reached a wrong number-
and you don't even need a phone!
Status at a Glance. Seven LEDs
indicate Smartmodem s current operating
mode: auto-answer, carrier detect, off
hook, receive data, send data, terminal
ready and modem ready You re never
left in the dark!
Direct-Connect Design.
Smartmodem is FCC registered for di-
rect connection to any modular phone
jack- there's no acoustic coupler to cause
signal loss and distortion.
Smartmodem, Smart Buy. Pro-
fessional quality features. Versatile per-
formance. A full two-year limited warranty
A suggested retail price of only $279.
What more could you want? Per-
haps the matching Hayes Stack Chrono-
graph, an RS-232C compatible calendar/
clock system.
Check out the Smartmodem wher-
ever fine computer products are sold.
And don't settle f<f\
for anything less I A 1 LJo««AO
than Hayes. ITJ ndytJO
Smartmodem.
The ultimate concept in mod(
is now a reality